#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
0 Comments