Question #55812

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().

Expert's answer

#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;
}
LATEST TUTORIALS
APPROVED BY CLIENTS