(Solved): Q: Write a C++ prog&…..

QUESTION

Question
Write a C++ program to read an integer number . Print the accumulative sum of squares of the sequence of number from 1 to (i.e. ).

ANSWERS:

Step 1: Program

#include <bits/stdc++.h>
using namespace std;
  

int squaresum(int n)
{
    
    int sum = 0;
    for (int i = 1; i <= n; i++)
        sum += (i * i);
    return sum;
}
  

int main()
{
    int n =

Leave a Comment

Your email address will not be published. Required fields are marked *