Using the function findSquare() that receives an input and returns the square of the input, write a complete program that calculates and displays the squares of the integers from 1 to 50.
c++ programming.
#include <iostream>
int findSquare(int v)
{
return v * v;
}
int main()
{
for(int i = 1; i <= 50; ++i)
{
std::cout << i << " ^ 2" << " = " << findSquare(i) << "\n";
}
return 0;
}
Comments
Leave a comment