47. WAP to understand [goto] control statement.
#include<stdio.h>
#include<unistd.h>
void
main()
{
int part;
printf("Enter part no : ");
scanf("%d",&part);
switch(part)
{
case 1:
printf("Hello..\n");
L1:
printf("Hi...\n");
goto L1;
printf("Bye...\n");
break;
case 2:;
int c = 0;
printf("Hi..\n");
L2:
sleep(1);
printf("Hello...\n");
c++;
if(c<10)
goto L2;
printf("Bye...");
break;
}
}
Comments
Post a Comment