-->
Showing posts with label electricity bill program. Show all posts
Showing posts with label electricity bill program. Show all posts

A program to calculate electricity bill for used hours/units

//The minimum charge for Nepal Electricity authority is Rs. 80 for 20 units consumed. If a  person //consumes more than that then s/he has to pay Rs. 7.25 per unit extra up to 100. If the person //consumes //more than 100 units then he has to pay 9.50 per unit. Write a 'C' program to calculate //bill.
#include<stdio.h>
#include<conio.h>
void main()
{
float total_units;
float total_amount;

printf("enter total units consumed\n");
scanf("%f",&total_units);
if(total_unit<=20)
    {
          printf("total amount to be paid=Rs. 80\n");
    }
elseif(total_unit>20 && total_unit<=100)
    {
         total_amount=80+7.25*(total_unit-20);
         printf("the amount=%f\n",total_amount);
      }
elseif(total_unit>100)
    {
         total_amount=80+9.5*(total_unit-20);
         printf("the amount=%f\n",total_amount);
      }  
printf("thank you!!!!\n");
getch();
}