Sunday, July 31, 2016

ELECTRICITY BILL- C Language

/* ELECTRICITY BILL */

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int u,y,z;
float b;
clrscr();
printf("Enter the no.of units::");
scanf("%d",&u);
if (u<=100)
{
b=u*3;
printf("The bill is%f",b);
}
else
if(u>100 && u<=200)
{
y=u-100;
b=(y*4)+300;
printf("The bill is %f",b);
}
else
{
z=u-200;
b=(z*4.5)+700;
printf("The bill is %f",b);
}
getch();
}


/************************OUTPUT***************************
Enter the no. of units::700
The bill is 2950.000000  */

No comments:

Post a Comment