Question #211056

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.


Expert's answer

#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;    
}

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!

LATEST TUTORIALS
APPROVED BY CLIENTS