-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscountBilling.c
More file actions
50 lines (40 loc) · 900 Bytes
/
DiscountBilling.c
File metadata and controls
50 lines (40 loc) · 900 Bytes
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
46
47
48
49
50
//
// DiscountBilling.c
//
//
// Created by Aditya Pudipeddi on 31/08/16.
//
//
#include <stdio.h>
int main()
{
int P1,P2,P3,P4;
float A,A1,A2,A3,A4;
printf("There are four products P1,P2,P3,P4 \n");
printf("Enter number of P1 bought: ");
scanf("%d",&P1);
printf("Enter number of P2 bought: ");
scanf("%d",&P2);
printf("Enter number of P3 bought: ");
scanf("%d",&P3);
printf("Enter number of P4 bought: ");
scanf("%d",&P4);
if (P1 >=5000)
A1 = P1*10*0.9;
else
A1 = P1*10;
if (P2 >=10000)
A2 = P2*25*0.85;
else
A2 = P2*25;
if (P3 >=10000)
A3 = P3*5*0.98;
else
A3 = P3*5;
if (P4 >= 1000)
A4 = P4*100*0.95;
else
A4 = P4*100;
A = A4 + A3 + A2 + A1;
printf("The amount to be paid is %f \n",A);
}