Lab 3
Lab 3
An electricity board charges the following rates for the use of electricity:
for the first 200 units 80 paise per unit: for the next 100 units 90 paise per
unit: beyond 300 units Rs 1 per unit. All users are charged a minimum of
Rs.100 as meter charge. If the total amount is more than Rs 400, then an
additional surcharge of 15% of total amount is charged. Write a program to
read the name of the user, number of units consumed and print out the
charges.
#include <stdio.h>
int main()
char name[10];
int unit;
float billAmount;
scanf("%s",name);
scanf("%d", &unit);
billAmount = 100;
if(unit<=200) {
billAmount= billAmount+(unit*.80);
billAmount= billAmount+(200*0.80)+((unit-200)*0.90);
billAmount= billAmount+(200*0.80)+(100*0.90)+((unit-300)*1);
if(billAmount>400){
billAmount=billAmount+(billAmount*0.15);
}
return 0;