Write a C program to find the sum of the
following
1*1*1+(1*1*1+2* 2*2)+(1*1*1+2*2 *2+3*3*3)+…n
terms
using for, while, do...while
reply to my inbox pleasee..thank you..:(
i've tried but still didnt work
can anyone check for me the mistake i made??? please..
my output should be
10
9
36
following
1*1*1+(1*1*1+2* 2*2)+(1*1*1+2*2 *2+3*3*3)+…n
terms
using for, while, do...while
reply to my inbox pleasee..thank you..:(
i've tried but still didnt work
Code:
main() { int i=1,sum=1,c=1,j; scanf("%d", &j); while(i<=j) { printf("%d\n", sum); i=i+1; c=(c*c*c)+i; sum=sum+c; } }
my output should be
10
9
36
Comment