ELECTRICITY BILL OF A DOMESTIC HOUSE - C-Tutorial

Latest

Monday, 26 September 2016

ELECTRICITY BILL OF A DOMESTIC HOUSE

/* ELECTRICITY BILL OF A DOMESTIC HOUSE */


#include<stdio.h>
#include<conio.h>
main()
{
int sno,nu,pr,cr;
float bill;
clrscr();
printf("\n\n Enter serial number: ");
scanf("%d",&sno);
printf("\n\n Enter previous reading: ");
scanf("%d",&pr);
printf("\n\n Enter current reading: ");
scanf("%d",&cr);
nu=cr-pr;
if(nu>0 && nu<=200)
{
bill=0.50*nu;
printf("\n Bill=%f",bill);
}
else if(nu>200 && nu<=400)
{
bill=100+0.65*(nu-200);
printf("\n Bill=%f",bill);
}
else if(nu>400 && nu<=600)
{
bill=230+0.80*(nu-400);
printf("\n Bill=%f",bill);
}
else if(nu>600)
{
bill=390+1.00*(nu-600);
printf("\n Bill=%f",bill);
}
getch();
}

No comments:

Post a Comment