Program to illustrate goto statement for looping

211602
Program to illustrate goto statement for looping
#include<stdio.h>
#include<conio.h>
void main()
{
 int i,n;
 clrscr();
 printf("enter n\n");
 scanf("%d",&n);
 i=1;
 label:
       printf("%8d",i);
       i=i+1;
       if(i<=n)
       goto label;
getch();
}
  Output
  enter n
  5
    1 2 3 4 5

 

 

Program to illustrate goto statement for looping goto statement example goto statement program program using goto statement