ADS

C Program To Find Sum Of Cubes Of N Numbers | C Programming

C Program To Find Sum Of Cubes Of N Numbers


#include <stdio.h>
#include <math.h>
int main ()
{
int i, n, sumcubes = 1;
printf("Enter n: \n");
scanf("%d", &n);
while (i <= n)
{
sumcubes += (i*i*i);
i++;
}
printf ("The sum of the cubes from 1 to %d is %d\n", n, sumcubes);
return 0;
}


OUTPUT
C Program to find sum of cubes of n numbers

Post a Comment

0 Comments