ssharish2005 . . .I tried your latest suggestion but it asks for a number & does nothing with it.
Code:
int i = 1, n = 1, sumcubes = 1;
printf("Enter n: \n");
scanf("%i", &n);
while (i++<n)
{
sumcubes += (i*i*i);
printf ("The sum of the cubes from 1..%d is %d\n", n,
sumcubes);
}
Oops I accidentally hit the post reply button too early but I can tell you
quzah I tried it your way & I guess it's better now but still does not yield to my desire (no double meaning)
Code:
{
/* Declare variables */
int i = 1, n = 1, sumcubes = 1;
/* Set for loop conditions */
while (i <= n)
{
printf("Enter n: \n");
scanf("%i", &n);
++i;
sumcubes += (i*i*i);
printf ("The sum of the cubes from 1..%d is %d\n", n,
sumcubes);
}