Q An electricity board charges according to the following rates:
For the first 100 units - 40 paisa per unit.
For the next 200 units - 50 paisa per unit.
beyond 300 units - 60 paisa per unit.
All users are charged meter charges also, which are Rs. 50/-
#include<stdio.h>
#include<conio.h>
void main()
{
float Rs; int unit;
clrscr();
printf("\n enter the unit of electricity ; " );
scanf("%d",&unit );
if(unit<100)
Rs=(unit*0.40);
else if (unit<=300&&unit>100)
Rs=40+((unit-100)*0.50);
else if(unit>300)
Rs=140+((unit-300)*0.60);
Rs=Rs+50;
printf("total bill:%f",Rs);
getch();
}
No comments:
Post a Comment