0% found this document useful (0 votes)
4 views3 pages

Break, Continue, Goto

The document contains two C programs that implement a simple menu for ordering food items and printing numbers. The first program allows users to order coffee, cold coffee, pizza, or cheese sandwiches, while the second one adds an option to print numbers from 1 to 10, skipping 3 and 7. Both programs utilize a loop with a 'goto' statement for menu navigation and handle invalid choices appropriately.

Uploaded by

landeparth93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Break, Continue, Goto

The document contains two C programs that implement a simple menu for ordering food items and printing numbers. The first program allows users to order coffee, cold coffee, pizza, or cheese sandwiches, while the second one adds an option to print numbers from 1 to 10, skipping 3 and 7. Both programs utilize a loop with a 'goto' statement for menu navigation and handle invalid choices appropriately.

Uploaded by

landeparth93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

 Break/goto

#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("5. exit\n");

printf("Enter your choice : ");

scanf("%d",&choice);

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);

default:

printf("invalid choice !!!");

 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");

printf("Enter your choice : ");


scanf("%d",&choice);

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 !!!");
}
}

You might also like