To find total price paid by a customer

Problem:

WAP to read price of three items. Apart from normal cost, a customer has to pay 13% VAT and 10% service charge. Finally, calculate the total price paid by the customer.


Source Code:

/*to find total price*/
#include<stdio.h>
int main()
{
float nc1, nc2, nc3, nc, vat, sc, tp;
printf("Enter normal cost of first item: ");
scanf("%f", &nc1);
printf("Enter normal cost of second item: ");
scanf("%f", &nc2);
printf("Enter normal cost of third item: ");
scanf("%f", &nc3);
nc = nc1 + nc2 + nc3;
vat = 0.13 * nc;
sc = 0.10 * nc;
tp = nc + vat + sc;
printf("Total net cost = %f", nc);
printf("\nVat = %f", vat);
printf("\nService charge = %f", sc);
printf("\nTotal price = %f", tp);
return 0;
}


Sample Run:

Enter normal cost of first item: 3000
Enter normal cost of second item: 4500
Enter normal cost of third item: 6000
Total net cost = 13500.00
Vat = 1755.00
Service charge = 135.00
Total price = 15390.00


No comments:

Post a Comment