by Dinesh Thakur Category: C Programming (Pratical)

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.

  1. Declare the variables.
  2. Using go to command.
  3. 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();
}
 Demonstrate the Use of Goto Command


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.