5.01.2012

Calculate sales tax

Q. Write a C program to calculate the total cost of items with adding sales tax.
Your program should guide the user to accept price of item and result with adding  sales tax.


Ans.


/*C program for calculate sales tax*/
#include<stdio.h>
#include<conio.h>
#define S_TAX 0.5
int main()
{
 float price,tot_cost;
 printf("Enter price of item : ");
 scanf("%f", &price);
 tot_cost=price+(price*S_TAX);
 printf("Total cost(with Sales Tax)= %f",tot_cost);
 getch();
 return 0;
}


/*****************Output*****************/
calculating sales tax
Screen shot for calculate sales tax