Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Electricity bill
- // Date : 20.10.19
- #include<stdio.h>
- int main(){
- printf("Enter the used electric unit: ");
- int unit;
- scanf("%d", &unit);
- double bill = 0;
- if(unit > 250){
- bill = (50 * 0.50) + (100 * 0.75) + (100 * 1.20) + ((unit - 250) * 1.50);
- }
- else if(unit > 150){
- bill = (50 * 0.5) + (100 * 0.75) + ((unit - 150) * 1.20);
- }
- else if( unit > 50){
- bill = (50 * 0.5) + ((unit - 50) * 0.75);
- }
- else bill = unit * 0.5;
- bill = bill + ((20 * bill) / 100);
- printf("%f", bill);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement