ELECTRICITY BILL GENERATION
DOMESTIC - SLAB SYSTEM
UNITS UNIT PRICE
1-50 1.45
51-100 2.8
101-200 3.05
201-300 4.75
301-500 6.00
>500 6.25
30 UNITS: 30*1.45 = 43.5
80 UNITS: 50*1.45 + 30 *2.8 = 156.50
180 UNITS: 50*1.45 + 50*2.8 + 80*3.05=456.5
280=50*1.45+50*2.8+100*3.05+80*4.75=897.5
380=50*1.45+50*2.8+100*3.05+100*4.75+80*6=1472.5
580=50*1.45+50*2.8+100*3.05+100*4.75+200*6+80*6.25=26
92.5
#include<stdio.h>
#include<conio.h>
void main()
{
long int serno, pre, cur, units;
char name[20];
float amt;
clrscr();
printf("Enter service no "); scanf("%ld",&serno);
printf("Enter consumer name "); scanf("%s",name);
printf("Enter previous month reading "); scanf("%ld",&pre);
printf("Enter current month reading "); scanf("%ld",&cur);
units = cur - pre;
if(units<=50)amt = units * 1.45;
else if( units<=100) amt = 50*1.45 + ( units-50 )* 2.8;
else if( units<=200) amt=50*1.45 + 50*2.8+(units-100)*3.05;
else if(units<=300)amt=50*1.45+50*2.8+100*3.05+(units-200)*4.75;
else if(units<=500)amt=50*1.45+50*2.8+100*3.05+100*4.75+(units-300)*6;
else amt=50*1.45+50*2.8+100*3.05+100*4.75+200*6+(units-500)*6.25;
printf("Amount=%.2f",amt);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
long int serno, pre, cur, units;
char name[20];
float amt;
clrscr();
printf("Enter service no "); scanf("%ld",&serno);
printf("Enter consumer name "); scanf("%s",name);
printf("Enter previous month reading "); scanf("%ld",&pre);
current:
printf("Enter current month reading "); scanf("%ld",&cur);
if( cur<pre ) { puts("\aCheck current month reading"); goto current; }
units = cur - pre;
if(units<=50)amt = units * 1.45;
else if( units<=100) amt = 50*1.45 + ( units-50 )* 2.8;
else if( units<=200) amt=50*1.45 + 50*2.8+(units-100)*3.05;
else if(units<=300)amt=50*1.45+50*2.8+100*3.05+(units-200)*4.75;
else if(units<=500)amt=50*1.45+50*2.8+100*3.05+100*4.75+(units-300)*6;
else amt=50*1.45+50*2.8+100*3.05+100*4.75+200*6+(units-500)*6.25;
if(amt<67)amt=67;
printf("Amount=%.2f",amt);
getch();