Write A C Program (WAP) to calculate slab wise Electricity Bill using If-Else Condition

Leave a Comment
/* In the following C program the user has to enter the total of his electricity consumption. The program will identify the slab of the residual units of the entered data then calculate the final bill.
The bill will be calculated on the basis of
<=100 Rs.3/units
> 100 and <=300 Rs.3.50/units
>300 and <=500 Rs.3.75/units
>500 Rs.4.5/units

/* 

#include<stdio.h>
#include<stdlib.h>
void main()
{
int units;
float t;
printf("Enter the no. of units:");
scanf("%d",&units);
if(units <= 100)
t = units * 3;
else if(units <= 300)
t = units * 3.5;
else if(units <= 500)
t = units * 3.75;
else
t = units * 4.5;
printf("the bill to be paid is = %f\n", t);
system("pause");
}


Output

Write A C Program (WAP) to calculate slab wise Electricity Bill using If-Else Condition
Write A C Program (WAP) to calculate slab wise Electricity Bill using If-Else Condition

0 comments: