-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct_billing_system.c
More file actions
45 lines (36 loc) · 1.31 KB
/
Copy pathproduct_billing_system.c
File metadata and controls
45 lines (36 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
Problem Statement: Write a C program to generate a product bill by taking product ID, name, price,
and quantity as input, and calculate total, CGST (6%), SGST (6%), and final bill amount.
*/
#include<stdio.h>
int main() {
int pid, price, qty, total;
char pname[10];
float cgst, sgst, ftotal;
printf("\nEnter the product id: ");
scanf("%d", &pid);
printf("\nEnter the product name: ");
scanf("%s", pname);
printf("\nEnter the product price: ");
scanf("%d", &price);
printf("\nEnter the product quantity: ");
scanf("%d", &qty);
total = price * qty;
cgst = total * 0.06;
sgst = total * 0.06;
ftotal = total + cgst + sgst;
printf("\n-----------------------------------------");
printf("\n\t---Product Bill---");
printf("\n-----------------------------------------");
printf("\n\tProduct ID = %d.", pid);
printf("\n\tProduct Name = %s.", pname);
printf("\n\tProduct Price = %d.", price);
printf("\n\tProduct Quantity = %d.", qty);
printf("\n\tTotal = %d.", total);
printf("\n-----------------------------------------");
printf("\n\tProduct CGST = %.2f.", cgst);
printf("\n\tProduct SGST = %.2f.", sgst);
printf("\n\tFinal Total = %.2f.", ftotal);
printf("\n-----------------------------------------");
return 0;
}