Menu Driven Program with if else
#include<stdio.h>
#include<stdlib.h>
void main()
{
int choice,qty=0,amt=0;
float ta;
printf("\nMenu Card:");
printf("\n1.Pavbhaji @50");
printf("\n2.Pizza @100");
printf("\n3.Burger @45");
printf("\nEnter Your Choice:");
scanf("%d",&choice);
if(choice==1)
{
printf("\nEnter Quantity ofPavbhaji");
scanf("%d",&qty);
amt=(qty*50);
}
else if(choice==2)
{
printf("\nEnter Quantity of Pizza:");
scanf("%d",&qty);
amt=(qty*100);
}
else if(choice==3)
{
printf("\nEnter Quantity of Burger:");
scanf("%d",&qty);
amt=(qty*45);
}
else
{
printf("\nYour Choice is not available here");
//exit(0);
}
ta=amt+.18*amt;
printf("\nTotal order amount is:%f",ta);
}
#include<stdlib.h>
void main()
{
int choice,qty=0,amt=0;
float ta;
printf("\nMenu Card:");
printf("\n1.Pavbhaji @50");
printf("\n2.Pizza @100");
printf("\n3.Burger @45");
printf("\nEnter Your Choice:");
scanf("%d",&choice);
if(choice==1)
{
printf("\nEnter Quantity ofPavbhaji");
scanf("%d",&qty);
amt=(qty*50);
}
else if(choice==2)
{
printf("\nEnter Quantity of Pizza:");
scanf("%d",&qty);
amt=(qty*100);
}
else if(choice==3)
{
printf("\nEnter Quantity of Burger:");
scanf("%d",&qty);
amt=(qty*45);
}
else
{
printf("\nYour Choice is not available here");
//exit(0);
}
ta=amt+.18*amt;
printf("\nTotal order amount is:%f",ta);
}
Comments
Post a Comment