C Tutorial
This c program is used to compute the sales tax based on user inputs cost and tax rate or percentage.
Sales tax = price of item × tax rate
#include<stdio.h> void main() { double cost, tax_rate, sales_tax; printf("Enter cost amount: "); scanf("%lf", &cost); printf("Enter tax rate: "); scanf("%lf", &tax_rate); sales_tax = cost*(tax_rate/100);; printf("Sales tax: %.2lf\n", sales_tax); }
Output:
$ cc sales-tax.c $ ./a.out Enter cost amount: 5000 Enter tax rate: 12 Sales tax: 600.00
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page