Program to illustrate goto statement for looping

0
18
#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

LEAVE A REPLY

Please enter your comment!
Please enter your name here