[Solved] Our professor asked us to make a C program that will display the cube of a number using a while loop [closed]


I would assume you’d want to compute the cube of a number by using a loop that iterates 3 times.

int n, cube, i;
printf("Enter an integer: ");
scanf("%d",&n); 

cube = 1;
i = 0;
while (i < 3)
{
    cube = cube * n;
    i++;
}

printf("%d\n", cube);

2

solved Our professor asked us to make a C program that will display the cube of a number using a while loop [closed]