# Find the sum of series -2+9-28+65-… N in C program

Here I shared C program to print the sum of first N terms of the series -2+9-28+65-... upto N. Given an integer N, the task is to print the total of first N terms of the series:

## What is the sum of -2+9-28+65-…n?

Below C program has given you the best way to find the sum of series.

## C Program

```
```

#include<stdio.h>
int main()
{
int i,m,n,sum=0;
printf("\nEnter the number of terms");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
m=i*i*i+1;
if(i%2==0)
{
printf("+%d",m);
sum=sum+m;
}
else
{
printf("-%d",m);
sum=sum-m;
}
}
printf("=%d",sum);
return 0;
}

## OUTPUT

Enter the number of terms 10

-2+9-28+65-126+217-344+513-730+1001=575

In the Above, C program finds the sum of first N terms of the series -2+9-28+65-… n and if you have any doubt please comment below.

Wow! What an excellent article!!! It is very helpful for me. I’ve learnt a lot of things from this post, thank you. If anyone wants to learn more you can also visit https://sisayed360.blogspot.com/

ReplyDeleteThanks For Response

Delete