Answer to Question #292433 in C++ for KELLY

Question #292433

make a c ++ program ethat calculate the sum ,mean of series numbers



1
Expert's answer
2022-01-31T15:04:21-0500
 #include <iostream>
using namespace std;


int main()
{
    int i, n, sum = 0, mean=0;
    cout << "\n\n Find the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + ... + (n*n):\n";
    cout << "------------------------------------------------------------------------------------\n";
    cout << " Input the value for nth term: ";
    cin >> n;


    for (i = 1; i <= n; i++) 
	{
        sum += i * i;
        cout << i << "*" << i << " = " << i * i << endl;
    }
    cout << " The sum of the above series is: " << sum << endl;
    
    for (i = 1; i<= n; i++)
    {
        mean = sum/n;
        cout << sum << "/" << n << " = " << sum/n << endl;
        
    }
    
    cout << " The Mean of the above series is: " << mean << endl;
}

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