/* * A program to calculate tax and total cost. */ #include /* printf, scanf definitions */ #define TAX_RATE .05 //constant rate of taxation int main (void) { double cost, tax, total; //spaces for item cost, tax, and total cost /* get the cost of the item */ printf("Enter cost of item: "); scanf("%lf", &cost); /* calculate the tax */ tax = cost * TAX_RATE; // calculate the total cost total = cost + tax; /* display the result */ printf("The tax on your item is $%5.2lf.\n", tax); printf("The total cost of your purchase is $%5.2lf.\n", total); return(0); }