Write a functions named sqrIt() that computes the square of the value passed to it and displays the result. The function would be capable of squaring numbers with decimal points. Make sure your function is called from main().
1
Expert's answer
2015-11-03T03:18:30-0500
#include <iostream> using namespace std; int squareIT(int n);
int main(){ for(int i=1;i<10;i++) { cout<<"i= "<<i<<" "<<"i^2 = "<<squareIT(i)<<endl; } return 0; } int squareIT(int n){ return n*n; }
Comments
Leave a comment