# C Program to Calculate Electricity Household Bill From Units Consumed

Can I teach the possibilities to understand the concept of “C Program to Calculate Electricity Household Bill From Units Consumed” using this tutorial? Come on! Without wasting our time, Move on to the tutorial directly.

## Program Code

``````/**
* C program to calculate total electricity bill
*/

#include <stdio.h>

int main()
{
int unit;
float amt, total_amt, sur_charge;

/* Input unit consumed from user */
printf("Enter total units consumed: ");
scanf("%d", &unit);

/* Calculate electricity bill according to given conditions */
if(unit <= 50)
{
amt = unit * 0.50;
}
else if(unit <= 150)
{
amt = 25 + ((unit-50) * 0.75);
}
else if(unit <= 250)
{
amt = 100 + ((unit-150) * 1.20);
}
else
{
amt = 220 + ((unit-250) * 1.50);
}

/*
* Calculate total electricity bill
*/
sur_charge = amt * 0.20;
total_amt  = amt + sur_charge;

printf("Electricity Bill = Rs. %.2f", total_amt);

return 0;
}``````

## Conclusion

I hope this article helps you to learn “C Program to Calculate Electricity Household Bill From Units Consumed”. If you face any issues please let me know via the comment section. Share this article with other C/C++ developers via social networks.

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.