Xiang
12-29-2002, 01:02 PM
Dear sir,
Why the tax1 variable can't be converted?
How can I make the amounts into currency format?
#include <stdio.h>
main()
{
int qty_sundae;
int qty_meals;
int qty_extra;
float sundae = 1.05;
float meal = 4.50;
float extra = 6.10;
float amount1;
float amount2;
float amount3;
float tax1;
printf("Enter no. of sundae cones : ");
scanf("%d", &qty_sundae);
printf("Enter no. of Happy meals : ");
scanf("%d", &qty_meals);
printf("Enter no. of Extra Value Meal : ");
scanf("%d", &qty_extra);
printf("\nWelcome to MC Donald's \n");
printf("Your Bill, \n");
amount1=qty_sundae*sundae;
amount2=qty_meals*meal;
amount3=qty_extra*extra;
printf("\t %d Sundae cones \t :RM %f \n", qty_sundae, amount1);
printf("\t %d Happy meals \t\t :RM %f \n", qty_meals, amount2);
printf("\t %d Extra value meals \t :RM %f \n", qty_extra, amount3);
tax1=((amount1+amount2+amount3)/100)*5;
printf("\t 5% Service Tax \t :RM %f \n", tax1);
printf("\nTotal Charges\t\t\t :RM %f \n", amount1 + amount2 + amount3 + tax1);
return 0;
}
Thanks
Xiang
Why the tax1 variable can't be converted?
How can I make the amounts into currency format?
#include <stdio.h>
main()
{
int qty_sundae;
int qty_meals;
int qty_extra;
float sundae = 1.05;
float meal = 4.50;
float extra = 6.10;
float amount1;
float amount2;
float amount3;
float tax1;
printf("Enter no. of sundae cones : ");
scanf("%d", &qty_sundae);
printf("Enter no. of Happy meals : ");
scanf("%d", &qty_meals);
printf("Enter no. of Extra Value Meal : ");
scanf("%d", &qty_extra);
printf("\nWelcome to MC Donald's \n");
printf("Your Bill, \n");
amount1=qty_sundae*sundae;
amount2=qty_meals*meal;
amount3=qty_extra*extra;
printf("\t %d Sundae cones \t :RM %f \n", qty_sundae, amount1);
printf("\t %d Happy meals \t\t :RM %f \n", qty_meals, amount2);
printf("\t %d Extra value meals \t :RM %f \n", qty_extra, amount3);
tax1=((amount1+amount2+amount3)/100)*5;
printf("\t 5% Service Tax \t :RM %f \n", tax1);
printf("\nTotal Charges\t\t\t :RM %f \n", amount1 + amount2 + amount3 + tax1);
return 0;
}
Thanks
Xiang