C Program to enter meter reading,calculate the cost and print out
how much is charged
#include<stdio .h="">
#include<conio .h="">
void main()
{
float mr,n,cost;
clrscr();
printf("\nEnter the meter reading:");
scanf("%f",&mr);
if(mr<=500)
{
printf("cost=10",cost);
}
else if((mr>500)&&(mr<=1000))
{
n=mr-500;
cost=10+n;
printf("cost=%0.2f",cost);
}
else
{
n=mr-1000;
cost=35+(2*n);
printf("cost=%0.2f",cost);
}
getch();
}
***********OUTPUT********
enter the meter reading:510
cost=20.00</conio></stdio>