Monday, 18 July 2011

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



#include





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
=

No comments:

Post a Comment