Blog

Simple Calculation In C

Question 1
Write a program to enter the selling price of a product. Add tax %and  insurance% cost. Calculate and print the final price.

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float cp,insurancepercent,taxpercent,finalprice,insurance,tax;
clrscr();
printf(“Enter the cost price=”);
scanf(“%f”,&cp);
printf(“Enter insurance charge=”);
scanf(“%f”,&insurancepercent);
printf(“Enter tax=”);
scanf(“%f”,&taxpercent);
tax= taxpercent/100*cp;
insurance=insurancepercent/100*cp;
finalprice=tax + cp + insurance;
printf(“%0.2f”,finalprice);
getch();
}

After running program 🙂