C++ Program to print a string multiple times using goto and labels [DEVCPP/GCC]


GOTO STATEMENT

The goto statement is used to transfer program control to some other part of the program without specifying any condition.

PROGRAM

//Program to print a string multiple times using goto and labels

#include <iostream>

using namespace std;

int main()
{
int a=0;

print:

if(a==10)
{
goto end;        //Transfers control to label end
}
else
{
a++;
cout<<"TECHCPP \n";
}

goto print;              //Transfers control to label print

end:
return 100;
}

OUTPUT

C++ Program to print a string multiple times using goto and labels

Share this

Related Posts

FIND US ON FACEBOOK!