Program to find the sum of series 1²+2²+3²+.+n² in C; Through this tutorial, we will learn how to find the sum of series 1²+2²+3²+….+n² using for loop in C Programming Language.

C Program to Find Sum of series 1²+2²+3²+…+n²

Finding the sum of a series of numbers is a common task in mathematics. In this blog post, we will discuss how to calculate the sum of the series 1²+2²+3²+…+n² using the C programming language.

The first step is to define the series. In this case, the series is 1²+2²+3²+…+n². This means that we are adding the squares of the numbers from 1 to n.

Next, we need to create a program to calculate the sum of the series. We can do this by using a for loop. The for loop will iterate from 1 to n and add the square of each number to a running total. Once the loop is complete, the total will be the sum of the series.

## Programs to Find Sum of series 1²+2²+3²+….+n² in C

C Program to Find Sum of series 1²+2²+3²+….+n² using For Loop

Here is the code for the program:

```
#include<stdio.h>
int main()
{
int n, sum=0;
printf("Enter The value Of N: ");
scanf("%d",&n);
for(int i=1; i<=n; i++)
{
//sum = sum + (i*i);
sum += i*i;
}
printf("The sum of the series 1²+2²+3²+…+n² is %d", sum);
return 0;
}
```

This program will take input from the user (n) and then calculate the sum of the series 1²+2²+3²+…+n².

Finally, we can test the program by running it with different values of n. For example, if we enter 5 as the value of n, the program will output the sum of the series 1²+2²+3²+4²+5², which is 55.

We have now successfully written a program to calculate the sum of the series 1²+2²+3²+…+n² using the C programming language.

## 0 Comments