The program is a simple menu card program that allows the user to select a drink from a list of options and then enter the quantity they would like to order. The program then calculates the total cost of the order by multiplying the quantity by the rate of the selected drink. The switch statement is used to match the user's selection with the corresponding drink and its rate. The default case is used to handle any input that does not match any of the options in the menu. The program then prints out the total amount for the order.
#include <stdio.h> int main() { int a,qty,rate,total; printf("\nMENU CARD \nSelect your drink \n1.COFFEE \n2.TEA \n3.COLD COFFEE \n4.MILK SHAKE \n5.STALC\n"); scanf("%d",&a); switch(a) { case 1: printf("\nYou have selected Coffee.\n Enter the quantity :"); scanf("%d",&qty); rate=5; total=qty*rate; printf("\nTotal amount :%d",total); break; case 2: printf("\nYou have selected Tea.\n Enter the quantity :"); scanf("%d",&qty); rate=10; total=qty*rate; printf("\nTotal amount :%d",total); break; case 3: printf("\nYou have selected Cold coffee.\n Enter the quantity :"); scanf("%d",&qty); rate=15; total=qty*rate; printf("\nTotal amount :%d",total); break; case 4: printf("\nYou have selected Milk shake.\n Enter the quantity :"); scanf("%d",&qty); rate=20; total=qty*rate; printf("\nTotal amount :%d",total); break; case 5: printf("\nYou have selected Stalc.\n Enter the quantity :"); scanf("%d",&qty); rate=15; total=qty*rate; printf("\nTotal amount :%d",total); break; default: printf("\nSorry Unavailable...%ds",a); break; } return 0; }To download raw file Click Here
MENU CARD Select your drink 1.COFFEE 2.TEA 3.COLD COFFEE 4.MILK SHAKE 5.STALC 2 You have selected Tea Enter the quantity : 5 Total amount :50
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions