Answer to Question #211056 in C++ for azmm

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.


1
Expert's answer
2021-06-27T14:11:59-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS