आज के समय में हर घर और दुकान में monthly electricity bill calculate करना एक जरूरी काम बन चुका है। लेकिन manually slab wise bill निकालना students के लिए काफी confusing होता है। इस tutorial में हम सीखेंगे How to Write Electricity Bill Program in C जो automatically consumed units के आधार पर charges calculate करेगा, GST जोड़ेगा और एक professional bill generate करेगा।
यह Electricity Bill Program in C खासतौर पर beginners, college practical और mini project के लिए एक perfect real-life example है।
इस Electricity Bill Program in C से आप क्या सीखेंगे ?
इस real-life based mini project को पूरा करने के बाद आप सिर्फ एक program नहीं बल्कि कई core programming skills सीख चुके होंगे:
- User Input Handling – scanf() का सही use करके consumer का नाम और consumed units लेना।
- Decision Making with if-else – Slab system के अनुसार अलग-अलग condition apply करना जैसे 50, 150 और 250 units के cases।
- Slab Wise Bill Calculation Logic – यह समझना कि कैसे different unit ranges पर अलग-अलग rate लगते हैं।
- Percentage Calculation (GST) – Bill amount पर 18% GST calculate करना और उसे main bill में add करना।
- Use of float Data Type – Decimal values के साथ calculation करना ताकि bill accurate आए।
- Professional Bill Format – Output को इस तरह design करना कि वह एक real electricity bill जैसा दिखे।
- Mini Project Development Skill – College practical या interview के लिए real-life utility program बनाने की confidence building।
Real Life में इसका Use कहाँ होता है?
| जगह | उपयोग |
| Homes | Monthly electricity bill |
| Shops | Meter reading sytem |
| Colleges | Mini projects |
| Coaching | Practical programs |
Electricity Bill Program in C – Logic Flow
- Consumer का नाम input
- Meter units input
- Units slab के हिसाब से bill calculate
- GST जोड़ना
- Final bill print करना
Electricity Bill Program in C –Flowchart

Electricity Bill Program in C – Source Code
#include<stdio.h>;
int main()
{
char name[50];
int units;
float bill, gst, total;
printf("Enter Consumer Name: ");
scanf("%s", name);
printf("Enter Units Consumed: ");
scanf("%d", &units);
if(units <= 50)
bill = units * 0.50;
else if(units <= 150)
bill = 50*0.50 + (units-50)*0.75;
else if(units <= 250)
bill = 50*0.50 + 100*0.75 + (units-150)*1.20;
else
bill = 50*0.50 + 100*0.75 + 100*1.20 + (units-250)*1.50;
gst = bill * 0.18;
total = bill + gst + 50; // 50 = fixed charge
printf("\n------ Electricity Bill ------\n");
printf("Name : %s\n", name);
printf("Units Used : %d\n", units);
printf("Bill Amount: %.2f\n", bill);
printf("GST (18%) : %.2f\n", gst);
printf("Total Bill : %.2f\n", total);
return 0;
}
Sample Output
Enter Consumer Name: Satyajit Enter Units Consumed: 180 ------ Electricity Bill ------ Name : Satyait Units Used : 180 Bill Amount: 150.00 GST (18%) : 27.00 Total Bill : 227.00
यह भी पढ़ें: What is File Handling in C Programming | सी में फ़ाइल हैंडलिंग क्या है (Beginner to Pro Guide)
Electricity Bill Program in C – Full Code Explanation
| Code Part | Code क्या करता है (Explanation) |
| #include<stdio.h> | यह header file standard input-output functions जैसे printf() और scanf() को use करने के लिए जरूरी होती है। |
| int main() | Program execution यहीं से start होता है। हर C program का entry point यही होता है। |
| char name[50]; | Consumer का नाम store करने के लिए character array बनाया गया है, जिसमें maximum 50 characters रखे जा सकते हैं। |
| int units; | Total consumed electricity units को store करने वाला variable है। |
| float bill, gst, total; | · bill → केवल units के charges
· gst → bill पर लगने वाला tax · total → final payable amount |
| printf(“Enter Consumer Name: “); | User को name input करने का message show करता है। |
| scanf(“%s”, name); | User द्वारा enter किया गया नाम name variable में store करता है। |
| printf(“Enter Units Consumed: “); | Units input करने के लिए user को prompt करता है। |
| scanf(“%d”, &units); | User द्वारा दिए गए units को units variable में store करता है। |
| if(units <= 50) | अगर units 50 या उससे कम हैं, तो ₹0.50 per unit charge किया जाता है। |
| else if(units <=150) | · पहले 50 units → ₹0.50
· बाकी units (50 से ऊपर) → ₹0.75 per unit |
| else if(units <= 250) | · पहले 50 → ₹0.50
· अगले 100 → ₹0.75 · बाकी → ₹1.20 per unit |
| else | · पहले 250 units पर fixed slab charge
· 250 से ऊपर के units → ₹1.50 per unit |
| gst = bill * 0.18; | Bill पर 18% GST calculate करता है। |
| total = bill + gst + 50; | Final payable bill = Units charge + GST + ₹50 fixed charge। |
| printf(“\n—— Electricity Bill ——\n”); | Bill heading print करता है। |
| printf(“Name : %s\n”, name); | Consumer का नाम show करता है। |
| printf(“Units Used : %d\n”, units); | Total units display करता है। |
| printf(“Bill Amount: %.2f\n”, bill); | Units के अनुसार calculate हुआ bill show करता है। |
| printf(“GST (18%) : %.2f\n”, gst); | GST amount display करता है। |
| printf(“Total Bill : %.2f\n”, total); | Final payable electricity bill print करता है। |
| return 0; | Program successfully complete होने का signal देता है और execution stop हो जाता है। |
Practice Assignment for Students
- Fixed charge को variable बनाइए
- GST percentage user से input करवाइए
- Name input में space allow करने के लिए fgets() use करें
यह भी पढ़ें: How to Write Student Marksheet Program in C – Complete Tutorial With Flowchart & Source Code
Best Online Resources to Learn C Programming
अगर आप programming को और भी गहराई से सीखना चाहते हैं, तो आप नीचे दिए गए popular programming websites पर जाकर online में high-quality tutorials से programming सीख सकते हैं।
निष्कर्ष (Conclusion)
इस article में आपने step-by-step समझा कि How to Write Electricity Bill Program in C और कैसे slab system, GST और fixed charges के साथ final bill generate किया जाता है। यह Electricity Bill Program in C आपकी logic building और if-else concept को मजबूत करता है, जो interviews और practical exams दोनों में बहुत useful है।
ऐसे ही और real-life C programs और mini projects के लिए tazahindi.com को जरूर bookmark करें।