When I input a negative integer the output will not result to it's cube value. I'm confused what should I do? here is my code:
#include <stdio.h>
int main()
{
int n, i, cube;
printf("Enter an integer: ");
scanf("%d",&n);
while (i<=n)
{
cube = i*i*i;
i++;
}
printf("The cube of %d = %d\n ", n, cube);
return 0;
}