If units of electricity used in a month are less than 200 the unit rate is 3.0 if units are 200 or greater than 200 the unit rate is 3.50 and additional charge of 10% of units are included.
#include<stdio.h>
#include<conio.h>
int main()
{
clrscr();
int cr,pr,unit;
float bill;
printf(“Enter Current Reading: “);
scanf(“%d”,&cr);
printf(“Enter Previous Reading: “);
scanf(“%d”,&pr);
unit=cr-pr;
printf(“Total Units of Electricity used in a Month: %d\n”,unit);
if(unit>=200)
{
bill=(unit*3.50)+(unit*0.1);
printf(“The bill is %0.2f”,bill);
}
if(unit<200)
{
bill=unit*3.0;
printf(“The bill is %0.2f”,bill);
}
getch();
return 0;
}