This program asks user to define the Goto Command. Goto command is a skip through command in C like if any condition got terminated or false the Goto command skip the process to desired location where it sets for skipping.
User takes the demo about if-else condition for defining the condition. Like user declares the variable a and b and find out the greater from a and b. user put the condition if-else if (a>b) and puts a GOTO command that prints or skip to A else GOTO b and prints a message A is greater or B is greater which condition lying true.
Problem Statement:
This is C program that asks user to demonstrate the GOTO command.
- Declare the variables.
- Using go to command.
- Display result on the screen.
Here is C source code for demonstrate the Go to Command. Output of this program shown below.
#include<stdio.h>
main()
{
int a,b;
clrscr();
printf("enter the value of a,b");
scanf("%d%d",&a,&b);
if(a>b)
goto A;
else goto B;
A:printf("a is greater");
goto End;
B:printf("b is greater");
End:
getch();
}