Filled Under:

C Program to calculate electric bill of a consumer- BASIC WAY

C Program to calculate electric bill of a consumer- BASIC WAY



C Program to calculate electric bill of a consumer

In this program I have discussed about the basic C Program to calculate electric bill of a consumer.

Here I have assumed that the the rate of per unit of current consumed is fixed at Rs 3.75. If the rate is made to be variable then the program will change.

--------------------------------------------------------------------

#include<stdio.h>
void main()
{ float prev,curr,net,bill;
printf("Enter the previous reading and the current reading:\n");
scanf("%f%f",&prev,&curr);
net=curr-prev;
bill=net*3.75;
printf("Your bill is: %f \n",bill);
}


---------------------------------------------------------------------

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

 

Copyright 2020 Programming in C All Right Reserved