#include<stdio.h>
int main(){
int unit,bill,bilg;
/*C program to input electricity unit charges and calculate total electricity bill according to the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill*/
printf("Enter the units of electricity burned by you : ");
scanf("%d", &unit);
if(unit<=50){
bill = unit*0.50;
bilg = bill + bill/5;
printf("The total bill is: %d", bilg);
}
else if(unit<=150){
bill = unit*0.75;
bilg = bill + bill/5;
printf("The total bill is: %d", bilg);
}
else if(unit<=250){
bill = unit*1.20;
bilg = bill + bill/5;
printf("The total bill is: %d", bilg);
}
else{
bill = unit*1.50;
bilg = bill + bill/5;
printf("The total bill is: %d", bilg);
}
return 0;
}
0 Comments