C PROGRAMMING LAB – 05] An electricity board charges the following rates for the use of electricity: for the first 200 units 80 paise per unit: for the next 100 units 90 paise per unit: beyond 300 units rupees 1 per unit. All users are charged a minimum of rupees 100 as a meter charge. If the total amount is more than Rs 400, then an additional surcharge of 15% of the total amount is charged. Write a program to read the name of the user, the number of units consumed, and print out the charges.


  • Step-1: Start
  • Step-2: Read the customer number
  • Step-3: Read the customer name
  • Step-4: Read the unit consumed
  • Step-5: If the unit is less than 200 than charge 0.80 per unit
  • Step-6: If the unit is greater than 200 and less than 300, than charge 0.90 per unit
  • Step-7: If the unit is greater than 400 than charge 1.00 per unit
  • Step-8: Calculate the amount by unit* charge
  • Step-9: If in case the amount is greater then 400, then an additional surcharge of 15% of the total amount is charge tatal-amount = amount + surcharge.
  • Step-10: Addition of Rs.100 as a minimum meter charge for all customer to the total amount
  • Step-11: Print the customer number, name, unit_consumed_amount, surcharge, totalAMOUNT + 100
  • Step-12: Stop

Flow Chart


Program -5 Source Code


void main()
   int cust_no, unit_con;
   float charge,surcharge=0, amt, total_amt;
   char nm[25];
   printf("Enter the customer IDNO :\t");
   printf("Enter the customer Name :\t");
   printf("Enter the unit consumed by customer  :\t");

   if (unit_con <200 )
      charge = 0.80;
   else if (unit_con>=200 && unit_con<300)
      charge = 0.90;
      charge = 1.00;

   amt = unit_con*charge;
   if (amt>400)
      surcharge = amt*15/100.0;
   total_amt = amt+surcharge;
   printf("\t\t\t\nElectricity Bill\n\n");
   printf("Customer IDNO                       :\t%d",cust_no);
   printf("\nCustomer Name                       :\t%s",nm);
   printf("\nunit Consumed                       :\t%d",unit_con);
   printf("\nAmount Charges @Rs. %4.2f  per unit  :\t%0.2f",charge,amt);
   printf("\nSurchage Amount                     :\t%.2f",surcharge);
   printf("\nMinimum meter charge Rs             :\t%d",100);
   printf("\nNet Amount Paid By the Customer     :\t%.2f",total_amt+100);



  • Enter the customer IDNO:
    • 002
  • Enter the customer Name:
    • Abhi
  • Enter the unit consumed by customer:
    • 493

Electricity Bill

  • Customer IDNO: 2
  • Customer Name: Abhi
  • Unit Consumed: 493
  • Amount Charges @Rs. 1.00 per cent unit: 493.00
  • Surcharge Amount: 73.95
  • Minimum meter charge Rs: 100
  • Net Amount Paid by the customer: 666.95

C PROGRAMMING -Viva Questions

1] Difference between float and double data types

2] Write the syntax of for loop?

3] What is the use of the break statement?

4] Difference between continue and break statement?

Leave a Reply

Your email address will not be published. Required fields are marked *

WhatsApp Icon Join For Job Alerts