Question: Write code for main with all other additional statements to get a number from the console then using the function squaresOf to display the result

Write code for main with all other additional statements to get a number from the console then using the function squaresOf to display the result to the console. (do not worry about keeping the console open).

Make sure to write the function prototype, and add all needed directives.

Below is the function squaresOf

#include

using namespace std;

int squaresOf(int n)

{

int sum=0;

for(int i=n;i>=1;i--)

{

sum=sum+i*i;

}

return sum;

}

int main() {

int n;

cout<<"enter the number : ";

cin>>n;

int sum=squaresOf(n);

cout<<"sum of squares of "<

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!