Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

c program that computes total bills

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

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){
printf("\n***Please select if what's your order:***\n");
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;
}
}
printf("\nYour total bill is P%.2f\n\n",totalBill);
}

  
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
Vhenieze Boholst author of c program that computes total bills is from Philippines.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!