Headlines
Loading...
C Program to enter meter reading,calculate the cost and print it out

C Program to enter meter reading,calculate the cost and print it out

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",&amp;mr);
if(mr&lt;=500)
{
 printf("cost=10",cost);
}
else if((mr&gt;500)&amp;&amp;(mr&lt;=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>
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***