C Program to Find Cube of a Number N Time (goto statement)

In this program, you'll learn to find cube of number user provided times. Here we have used goto statement. A goto statement in C programming provides an unconditional jump from the 'goto' to a labeled statement in the same function. Any program that uses a goto can be rewritten to avoid them. Syntax: goto label; Example: goto start; First time the user is ask for the number then cube will be find and displayed. After that it will again ask user for the continue option. If user enters choice as 1 then it will goto start asks for the next number, if user enters choice as 0 then program will terminate.

Source Code

int main()
    int n, ch;
    printf("\nEnter the number: ");
    scanf("%d", &n);

    printf("Cube = %d",n*n*n);
    printf("\nDo u want to continue (1/0): ");
    scanf("%d", &ch);

    if(ch == 1)
        goto start;
    printf("GOOD BYE..");
    return 0;
Enter the number: 7
Cube = 343
Do u want to continue (1/0): 1

Enter the number: 5
Cube = 125
Do u want to continue (1/0): 0

"Coding Hub - Learn to code" app now available on Google Play Store