Break, Continue, Goto
Break, Continue, Goto
#include<stdio.h>
#include<stdlib.h>
int main()
int choice;
start:
printf("1. coffee\n");
printf("3. pizza\n");
printf("5. exit\n");
scanf("%d",&choice);
switch(choice)
case 1:
goto start;
case 2:
goto start;
case 3:
goto start;
case 4:
case 5:
exit(0);
default:
Continue
#include<stdio.h>
#include<stdlib.h>
int main()
{
int choice;
start:
printf("1. coffee\n");
printf("2. cold coffee\n");
printf("3. pizza\n");
printf("4. cheese sandwitch\n");
printf("6. print 1 to 10 number \n");
printf("5. exit\n");
switch(choice)
{
case 1:
printf("coffee ordered successfully...\n");
goto start;
case 2:
printf("cold coffee ordered successfully...\n");
goto start;
case 3:
printf("pizza ordered successfully...\n");
goto start;
case 4:
printf("cheese sandwich ordered successfully...\n");
goto start;
case 5:
exit(0);
case 6:
for(int i =0; i<=10; i++)
{
if(i==3 || i==7)
{
continue;
}
printf("%d\t",i);
}
break;
default:
printf("invalid choice !!!");
}
}