Skip to content

Instantly share code, notes, and snippets.

Created September 7, 2016 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/ae12692727c224ab70024c6d1ba4f18f to your computer and use it in GitHub Desktop.
Save anonymous/ae12692727c224ab70024c6d1ba4f18f to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define TAX_RATE 0.065
int main(void) {
double item_cost, total, total_cost;
int items, taxed;
printf("What is the cost of the item to be purchased (in dollars)?\n\n");
scanf("%lf", &item_cost);
printf("How many of the item are you purchasing?\n\n");
scanf("%d", &items);
total_cost = item_cost * items;
printf("Is the item a taxed item (1 = yes, 0 = no)?\n\n");
scanf("%d", &taxed);
total = total_cost * (TAX_RATE + taxed);
printf("The total comes out to $%.2lf", total);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment