#include
#include
void main()
{
int cno,pmr,cmr,cu;
float total;
char sec;
char cname[10];
clrscr();
printf(" ENTER the SECTOR : ");
scanf("%c",&sec);
printf(" Enter customer name : ");
scanf("%s",&cname);
printf(" Enter customer number : ");
scanf("%d",cno);
printf(" Enter the previous units : ");
scanf("%d",&pmr);
printf(" Enter the current units : ");
scanf("%d",&cmr);
cu=cmr-pmr;
if(sec == 'a')
{
if(cu>300)
total=cu*2.00;
if(cu>200 && cu<=300)
total=cu*1.50;
if(cu>100 && cu<=200)
total=cu*1.00;
if(cu<=100)
total=cu*0.50;
}
if(sec=='i')
{
if(cu>300)
total=cu*4.00;
if(cu>200 && cu<=300)
total=cu*3.00;
if(cu>100 && cu<=200)
total=cu*2.00;
if(cu<=100)
total=cu*1.00;
}
if(sec == 'a')
{
if(cu>300)
total=cu*2.00;
if(cu>200 && cu<=300)
total=cu*1.50;
if(cu>100 && cu<=200)
total=cu*1.00;
if(cu<=100)
total=cu*0.50;
}
if(sec == 'd')
{
if(cu>300)
total=cu*2.00;
if(cu>200 && cu<=300)
total=cu*1.50;
if(cu>100 && cu<=200)
total=cu*1.00;
if(cu<=100)
total=cu*0.50;
}
printf("\n Customer name : %s ",cname);
printf("\n Customer number : %d",cno);
printf("\n Previous Units : %d",pmr);
printf("\n Current Units : %d",cmr);
printf("\n Category : %c",sec);
printf("\n Consumed Units : %d",cu);
printf("\n Electric Bill : %f",total);
getch();
}
C Program to calculate Electric Bill
C Program to calculate Electric Bill
No comments:
Post a Comment