goto statement in C.

 

01 #include<stdio.h>
02
03 int main()
04 {
05 int i=0;
06
07 label:
08
09 printf("nPress 1 To End Program : ");
10 scanf("%d",&i);
11
12 if(i!=1)
13 {
14 printf("nYou enter %d. Goto Executesn",i);
15 goto label;
16 }
17 printf("nEnd Of Program !!!");
18 return 0;
19 }
 
 OUTPUT :

Press 1 To End Program : 4

You enter 4. Goto Executes

Press 1 To End Program : 2

You enter 2. Goto Executes

Press 1 To End Program : 1

End Of Program !!!

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *