0% found this document useful (0 votes)
11 views8 pages

12-08-23 Net Batch Nested If Structure

The document outlines an electricity bill generation system that uses a slab system to calculate charges based on units of consumption. It provides the unit prices for different slabs of consumption ranging from 1-50 units to over 500 units. It then shows sample calculations of the total charges for various consumption units between 30 to 580 units.

Uploaded by

Amol Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

12-08-23 Net Batch Nested If Structure

The document outlines an electricity bill generation system that uses a slab system to calculate charges based on units of consumption. It provides the unit prices for different slabs of consumption ranging from 1-50 units to over 500 units. It then shows sample calculations of the total charges for various consumption units between 30 to 580 units.

Uploaded by

Amol Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

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();

You might also like