INDEX

Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3

Write a c program or code to find out the sum of series 1^3 + 2^3 + …. + n^3 that is sum of cube of n natural numbers.

#include<stdio.h>
#include<math.h>

int main(){

int n,i;
int sum=0;

printf("Enter the n i.e. max values of series: ");
scanf("%d",&n);

sum = pow(((n * (n + 1) ) / 2),2);

printf("Sum of the series : ");

for(i =1;i<=n;i++){
if (i != n)
printf("%d^3 + ",i);
else
printf("%d^3 = %d ",i,sum);
}

return 0;
}

Sample output:
Enter the n i.e. max values of series: 3
Sum of the series: 1^3 + 2^3 + 3^3 = 36

Mathematical Formula:
Sum of the series 13 + 23 + 33 + … + n3 = (n (n+1)/2)2

6. Write a c program to find out the sum of given H.P.

If you have any suggestions on above sum of cube of n natural numbers, please share us.

25 comments:

Dheeraj Awale said...

how to calculate 1^2+2^3+3^4+...n^n+1

Priyanka kumari said...

Hi Dj,

I hope this program will help you.

#include "math.h"
int main(){

int sum=0,i=0,n;
scanf("%d",&n);

for(i=1;i<=n;i++){
sum = sum + pow(i,i+1);
}

printf("Sum of series: %d" sum);

}

Anonymous said...

how to calculate 1+2^3+3^5+4^7+....+n^m

Anonymous said...

how to calculate 1+2^3+3^5+4^7+.............+n^m

Anonymous said...

how to read 3 numbers a,r,n. and generate AP,GP,HP

Unknown said...

Thanks

Unknown said...

please help me in follwing program
1^4 + 2^4 + 3^4+5^4+7^4+....... upto 20 terms program

Pratik said...

1+1/2^2+..+1/n^n

Unknown said...

Mr. Ritesh I need help in the following :
1. 1+1=1
2. 1+2=3
3. 1+2+3=6
4. 1+2+3+4=10 Where N will come from keyboard input.

Unknown said...

#include
#include
#include
int main()
{
int i,j,k,x=0,n;
long sum=0;
printf("Enter Limit Of Serires ");
scanf("%d",&n);
printf("1");
for(i=2,j=3;i<=n;i++,j=j+2)
{
x=pow(i,j);
sum=sum+x;
printf(" + %d^%d",i,j);
}
printf("=%ld",sum+1);
getch();
}

storyline said...
This comment has been removed by the author.
Zahir AMM said...
This comment has been removed by the author.
Zahir AMM said...

how to write a c program for sinx=x-(x^3/3!)+(x^5/5!)+...... this please help someone

Zahir AMM said...

how to write a c program for sinx=x-(x^3/3!)+(x^5/5!)+...... this please help someone
my email zahirkalmunai90@gmail.com

Unknown said...

Design an algorithm to find the sum of the first n terms of the series. fs=0!+1!+2!+3!+……+n!(n>=0).

Unknown said...

thanx for this and give me answer to the 1,8,27,64 print series

Unknown said...

please help me in follwing program
s = x - x^2 + x^4- ... + x^n

Unknown said...
This comment has been removed by the author.
Unknown said...

how to calculate the series 1*1+1*2+2*3+3*5+5*8+8*13........

Unknown said...

How to calculate the series 1^3 + 2^3 + …. + n^3=? in recursive function.

Poetrystore.in said...

1 n! 2*(n-1)! 3(n-2)! ...... (n-2)*3! (n-1)*2! n*1! how to calculate this typ of series

Unknown said...
This comment has been removed by the author.
Unknown said...

Can anyone please help me with this series 2,6,11,10,15,21,18,24,31,26,35,41

Unknown said...

URGENT!!!!
GIVE ME THE PROGRAM OF - 2X6+8X12+14X18+.....N

Unknown said...

plz help me the number sequence 120,99,80,65.....