Monday, July 13, 2020

Program of electricity board

 Q.......Develop a program of electricity board of calculating bill of consumer based on unit consumption
                  

             UNIT                                                                RATE
           
            First 100                                                         5.10
            Second 101-150                                             6.20
            Next  151-250                                                 7.10
            Next 251                                                         8.40
             

#include<stdio.h>
#include<conio.h>
int main()
{
int unit;
float bill;
printf("input reading in unit:");
scanf("%d",&unit);
if(unit<=100)
bill=unit*5.70;
else if(unit<=150)
bill=100*5.70+(unit-100)*6.20;
else if(unit<=250)
bill=100*5.70+50*6.20+(unit-150)*7.10;
else
bill=100*5.70+50*6.20+50*7.10+(unit-250)*8.40;
printf("Net bill=%.2f",bill+200);
getch();
}

No comments:

Post a Comment

Program of electricity board

 Q.......Develop a program of electricity board of calculating bill of consumer based on unit consumption                                 UN...