Answer to Question #55812 in C++ for Dharvin

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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS