-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectricityBill.c
More file actions
36 lines (33 loc) · 928 Bytes
/
electricityBill.c
File metadata and controls
36 lines (33 loc) · 928 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
/**
* @file electricityBill.c
* calculate the electricity bill.
* @author Md. Alamin (alamin5g@yahoo.com)
* I would love be a software engineer at Google. That is why anybody can uses this code without any condition, if you face any difficulty, then try to email me.
* @version 0.1
* @date 2022-03-21
*
* @copyright Copyright (c) 2022
*
*/
#include <stdio.h>
void main()
{
int unit;
float amt, sur_charge, total_amt, net_amt;
printf("Enter unit(s): ");
scanf("%d", &unit);
if (unit <= 50)
{
amt = unit * 0.50;
sur_charge = amt * 0.20;
net_amt = amt + sur_charge;
printf("The net payable amount is %.2f", net_amt);
}
else if (unit > 50 && unit <= 100)
{
total_amt = 25 + ((unit - 50) * 0.75);
sur_charge = total_amt * 0.20;
net_amt = total_amt + sur_charge;
printf("The net payable amount is %.2f", net_amt);
}
}