Hello. I'm new to Daniweb and am trying to create a program in C that will compile sales tax after the user inputs a purchase amount. Am I doing it right? I would appreciate any suggestions and feedback. Also, I am unable to see my output using the Run function in Miracle C Workbench.
Sincerely,
Gia
{
//Declare variables
int b = 725, c = 750, d = 775, e = 10000;
int DelMarTaxRate, EncinitasTaxRate, LaJollaTaxRate, PurchaseAmount, DelMarSalesTax, EncinitasSalesTax, LaJollaSalesTax;
//Calculate tax rates
DelMarTaxRate = b/e;
EncinitasTaxRate = c/e;
LaJollaTaxRate = d/e;
//Ask user for purchase amount
printf("\nPlease enter your purchase amount: ");
scanf("s%", PurchaseAmount);
//Thank user for entering purchase amount
printf("n\Thank you. You entered %s\n" PurchaseAmount);
//Calculate sales tax
DelMarSalesTax = PurchaseAmount*b/e;
EncinitasSalesTax = PurchaseAmount*c/e;
LaJollaSalesTax = PurchaseAmount*d/e;
//Display results
printf("DelMar: %d\n Encinitas: %d\n LaJolla: %d\n", DelMarTaxRate, EncinitasTaxRate, LaJollaTaxRate);
printf("%ld\n", PurchaseAmount);
printf("%ld\n", DelMarSalesTax);
printf("%ld\n", EncinitasSalesTax);
printf("%ld\n", LaJollaSalesTax);
printf("\nPress any key to end.");
getche();
}