Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Want to put your expertise in the spotlight?

Answered: 1 week ago