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*****************/
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*****************/
Screen shot for calculate sales tax |
Comments
Post a Comment