Programming Examples

Write a program to calculate electricity bill

Write a program to calculate electricity bill. Read the starting and ending meter reading. 

The charges are as follows.

No. of units consumed Rates in (Rs.)

200–500 3.50
100–200  2.50
Less than 100 1.50


void main()
int initial,final,consumed;
float total;
printf(“\n Initial & Final Readings :”);
scanf(“%d %d”, &initial, &final);
consumed = final-initial;
if(consumed>=200 && consumed<=500)
total=consumed * 3.50;
else if(consumed>=100 && consumed<=199)
total= consumed * 2.50;
else if(consumed<100)
printf(“Total bill for %d unit is %f”,consumed,total);


Initial & Final Readings : 800 850

Total bill for 50 unit is 75.000000

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz