Search:

Submit Article

# c program that computes total bills

Posted By: Vhenieze Boholst     Category: C Programming     Views: 25684

### this program computes the total bill of a customer eating in a carenderia. His order is entered and the corresponding prices are computed.

#include<stdio.h>
#include<string.h>
main(){
char order[20];
float totalBill=0;
int price;
printf("**Menu:**\n**\tA=Rice = P15.00\t**\n**\tB=Friedchicken  =  P35.00**\n**\tC=Porkchop  = P65.00\t**\n**\tD=Fishtinola  =P15.00\t**\n**\tD=Porkmenudo  =P45.00\t**\n**\tF=Chopsuey  =P25.00\t**\n*****   Q=Quit/Done  ****\n\n");
while(!(strcmp(order,"Q"))==0 || strcmp(order,"q")==0){
scanf("%s",order);
if(strcmp(order,"A")==0 || strcmp(order,"a")==0){
totalBill=totalBill+15;
}
else if (strcmp(order,"B")==0 || strcmp(order,"b")==0){
totalBill=totalBill+35;
}
else if (strcmp(order,"C")==0 || strcmp(order,"c")==0){
totalBill=totalBill+65;
}
else if (strcmp(order,"D")==0 || strcmp(order,"d")==0){
totalBill=totalBill+15;
}
else if (strcmp(order,"E")==0 || strcmp(order,"e")==0){
totalBill=totalBill+45;
}
else if (strcmp(order,"F")==0 || strcmp(order,"f")==0){
totalBill=totalBill+25;
}
}
}

Share:

Didn't find what you were looking for? Find more on c program that computes total bills Or get search suggestion and latest updates.

 Vhenieze Boholst author of c program that computes total bills is from Philippines. View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!