price + sales tax calculator
I am trying to make a simple program that allow you to enter the value of an item, then adds on a sales tax of 5.6 percent and outputs in the following format:"Item price of $10.00 with sales tax is 10 dollars and 56 cents".
I have made a program so far that calculates the sales tax, adds it to the item price and then gives a resulting floating point number. However, I do not know how to display the result in the format above. Here is what I have written so far. Any help would be great!
#define TAXRATE .056
float item, tax, total_cost;
printf("Enter the value of your item\n");
scanf(" %f", &item);
tax = item * TAXRATE;
total_cost = item + tax;
printf("Your item of $%.2f with sales tax is %.2f", item, total_cost);