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
using namespace std;

int main()
    int n, ch;
    cout<<"\nEnter the number: ";
    cin>> n;

    cout<< n*n*n;
    cout<<"\nDo u want to continue (1/0): ";
    cin>> ch;

    if(ch == 1)
        goto start;
    cout<<"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