-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElectricity_Bill.c
80 lines (79 loc) · 1.47 KB
/
Electricity_Bill.c
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include<stdio.h>
int main(){
int unit;
float c,sc,tc;
scanf("%d",&unit);
if(unit<200){
c=unit*1.20;
tc=c;
printf("Units Consumed: %d
",unit);
printf("Cost per Unit: 1.20
");
printf("Bill: %0.2f
",c);
printf("Surcharge: %0.2f
",sc);
printf("Total Amount: %0.2f
",tc);
}
else if(unit>=200 && unit<400)
{
c=unit*1.40;
tc=c;
printf("Units Consumed: %d
",unit);
printf("Cost per Unit: 1.40
");
printf("Bill: %0.2f
",c);
printf("Surcharge: %0.2f
",sc);
printf("Total Amount: %0.2f
",tc);
}else if(unit>=400 && unit<600)
{
c=unit*1.60;
sc=c*0.15;
tc=c+sc;
printf("Units Consumed: %d
",unit);
printf("Cost per Unit: 1.60
");
printf("Bill: %0.2f
",c);
printf("Surcharge: %0.2f
",sc);
printf("Total Amount: %0.2f
",tc);
}else if(unit>=600 && unit<800)
{
c=unit*1.80;
sc=c*0.15;
tc=c+sc;
printf("Units Consumed: %d
",unit);
printf("Cost per Unit: 1.80
");
printf("Bill: %0.2f
",c);
printf("Surcharge: %0.2f
",sc);
printf("Total Amount: %0.2f
",tc);
}else{
c=unit*2.00;
sc=c*0.15;
tc=c+sc;
printf("Units Consumed: %d
",unit);
printf("Cost per Unit: 2.00
");
printf("Bill: %0.2f
",c);
printf("Surcharge: %0.2f
",sc);
printf("Total Amount: %0.2f
",tc);
}
}