Total Sales Calculation

#include <stdio.h> #define TAX_RATE 8.50 int main() { // Local declarations int quantity; float discountrate; float discountamt; float unitprice; float subtotal; float subtaxable; float taxam; float total; // Statements printf("Enter the number of items sold:\n"); scanf("%d", &quantity); printf("Enter the unit price:\n"); scanf("%f", &unitprice); printf("Enter the discount rate (percent):\n"); scanf("%f", &discountrate); subtotal = quantity * unitprice; discountamt = subtotal * discountrate / 100; subtaxable = subtotal - discountamt; taxam = subtaxable * TAX_RATE / 100; total = subtaxable + taxam; printf("\nQuantity sold: %6d\n", quantity); printf("Unit price of items: %9.2f\n", unitprice); printf("---------------\n"); printf("Subtotal: %9.2f\n", subtotal); printf("Discount: %-9.2f\n", discountamt); printf("Discount total: %9.2f\n", subtaxable); printf("Sales tax: %+9.2f\n", taxam); printf("Total sales: %9.2f\n", total); return 0; }