An electric bill distribution company arranges its domestic consumers as follows
#include<stdio.h>
void main(){
float ut,cost,p;
printf("Enter the unit consumed");
scanf("%f",&ut);
if(ut>=0&&ut<201)
{
cost=(0.5*ut);
printf("Your bill is %f \n",cost);}
else if(ut>200&&ut<401)
{p=ut-200;
cost=100+(0.65*p);
printf("Your bill is %f \n",cost);}
else if(ut>400&&ut<601)
{p=ut-400;
cost=250+(0.80*p);
printf("Your bill is %f \n",cost);}
else if(ut>600)
{p=ut-600;
cost=425+(1.25*p);
printf("Your bill is %f \n",cost);}
}
-----------------------------------------------------------------------------------------
Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.
Enjoy programming in C.
0 comments:
Post a Comment