-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path1_Electricity_bill.c
47 lines (41 loc) · 1.21 KB
/
1_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
//A simple program of electricity bill generator
#include<stdio.h>
#include <stdlib.h>
int main(){
int units;
float price;
printf("Enter the units:\t");
scanf("%d",&units);
system("clear");
if(units<=20){
price=units*4;
}
else if(units<=50){
price=(20*4)+((units-20)*7.3);
}
else if(units<=150){
price=((20*4)+(50*7.3))+((units-50)*8.6);
}
else if(units<=250){
price=(20*4+30*7.3+100*8.6)+((units-150)*9.5);
}
else if(units>250){
price=(20*4+30*7.3+100*8.6+100*9.5)+((units-250)*12.5);
}
//you can automate the bill no, date and sc no for advancement
printf("~~~NEPAL ELECTRICITY AUTHORITY~~~\n");
printf("-----------------------------------\n");
printf("\tELECTRICITY BILL\n");
printf("-----------------------------------\n\n");
printf("BILL NO:\t843948394\n");
printf("BILL DATE:\t2079/12/12\n");
printf("BRANCH:\t\tDAMAK\n");
printf("-----------------------------------\n");
printf("SC NO:\t\t309.11.012A\n");
printf("BILL NO:\t843948394\n");
printf("TOTAL UNITS:\t%d\n",units);
printf("TOTAL AMOUNT:\tRS.%.3f\n",price);
printf("-----------------------------------\n");
printf("-----------------------------------\n");
return 0;
}