You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
423 B
C

#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;
}