Created
January 19, 2023 15:12
-
-
Save lazuee/426c41fc99954ba58d6a77aceab096c4 to your computer and use it in GitHub Desktop.
Calculating Sales Tax on a Purchase in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int main() { | |
double purchase, tax_rate, total_bill; | |
char county; | |
printf("AMOUNT OF PURCHASE? "); | |
scanf("%lf", &purchase); | |
printf("COUNTY? "); | |
scanf(" %c", &county); | |
if (county == 'A') { | |
tax_rate = 0.07; | |
} else { | |
tax_rate = 0.06; | |
} | |
total_bill = purchase + (purchase * tax_rate); | |
printf("TOTAL BILL: %.2lf\n", total_bill); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment