Description
In this tutorial we write a c program which print the menus of restaurant with product and price and after buy the product we ask the quantity of the particular product and print the total amount pay.
Now Let's start the code...
#include<stdio.h>
int main(){
printf("\n\t\t\t\t**** WELCOME TO RESTAURANT ****\n\n");
printf("\nMENU CARD\n");
int choice, qty, total=0;
printf("\n\tPRODUCT\t\t\t\tPRICE\n\n1. ORANGE JUICE\t\t\t\t20Rs.\n2. MILK SHAKE\t\t\t\t50Rs.\n3. COFFEE\t\t\t\t30Rs.\n4. TEA\t\t\t\t\t10Rs.\n5. ICE-CREAM\t\t\t\t40Rs.\n\nSELECT ANYONE : ");
scanf("%d", &choice);
switch (choice)
{
case 1:
printf("ORANGE JUICE SELECTED, PLEASE! Enter the Quantity : ");
scanf("%d", &qty);
total = qty * 20;
printf("Total Amount For Pay : %d", total);
break;
case 2:
printf("MILK SHAKE SELECTED, PLEASE! Enter the Quantity : ");
scanf("%d", &qty);
total = qty * 50;
printf("Total Amount For Pay : %d", total);
break;
case 3:
printf("COFFEE SELECTED, PLEASE! Enter the Quantity : ");
scanf("%d", &qty);
total = qty * 30;
printf("Total Amount For Pay : %d", total);
break;
case 4:
printf("TEA SELECTED, PLEASE! Enter the Quantity : ");
scanf("%d", &qty);
total = qty * 10;
printf("Total Amount For Pay : %d", total);
break;
case 5:
printf("ICE-CREAM SELECTED, PLEASE! Enter the Quantity : ");
scanf("%d", &qty);
total = qty * 40;
printf("Total Amount For Pay : %d", total);
break;
default:
printf("We are Sorry, for this....");
break;
}
return 0;
}
Output :
**** WELCOME TO RESTAURANT ****
MENU CARD
PRODUCT PRICE
1. ORANGE JUICE 20Rs.
2. MILK SHAKE 50Rs.
3. COFFEE 30Rs.
4. TEA 10Rs.
5. ICE-CREAM 40Rs.
SELECT ANYONE : 2
MILK SHAKE SELECTED, PLEASE! Enter the Quantity : 3
Total Amount For Pay : 150
Recommended Posts
Primary Arithmetic program in c programming and cpp programming language
Write a c and c++ programming language , primary Arithmetic Program
Automorphic Number | C programming language | @lapmos
An automorphic number is a number that has the same digit at the end of the square as the given number is an automorphic number. For Example : 25 is a Automorphic Number.
9 basic program in cpp programming language | @lapmos
In this post we write the 9 basic program in c programming language which is based the basic understanding of c++ programming language.
Spy Number | c programming
Today we are going to write a program which is to check if given number is spy or not and yes the most important thing is what is spy number, you will get the answer of all these on this blog.
Display Name of the month by accepting digit of the month | c programming
We will print the month name from the month number given by the user which will give us the user input. For Example : User Entered 5 then print
Happy Numbers | with Example And Programs
Replace the number by the sum of the squares of its digits, and repeat the process. At the end, if the number is equals to 1 then it is a Happy Number, or it loops endlessly in a cycle that does not include 1 (if it is not a happy number then this process will end at 4).