Skip to content
Exercise · Q11

Q.Write an algorithm to display the total water bill charges of the month depending upon the number of units consumed by the customer as per the following criteria:
• for the first 100 units @ 5 per unit
• for next 150 units @ 10 per unit
• more than 250 units @ 20 per unit
Also add meter charges of 75 per month to calculate the total water bill.

Lakshadweep CbseNCERTSubjective· 3mImportance★★★★★est
81% · 29/36 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

A slab (piecewise) tariff: the first 100 units cost 5 each, the next 150 cost 10 each, anything beyond 250 costs 20 each — then a flat ₹75 meter charge is added.

The idea (piecewise billing). The trap in slab billing is that a customer using 275 units does not pay 20 for all 275 units — each slab is billed at its own rate, and only the units falling inside a slab get that slab's rate. So the computation branches on which slab the consumption reaches, and the earlier slabs are always charged in full once passed.

Algorithm

WATER_BILL_ALGO
Step 1: INPUT units
Step 2: IF units <= 100 THEN
            amount = units * 5
        ELSE IF units <= 250 THEN
            amount = 100 * 5 + (units - 100) * 10
        ELSE
            amount = 100 * 5 + 150 * 10 + (units - 250) * 20
        END IF
Step 3: totalBill = amount + 75          (meter charge)
Step 4: PRINT "Total water bill =", totalBill
END

Python verification

units = int(input("Enter units consumed: "))
if units <= 100:
    amount = units * 5
elif units <= 250:
    amount = 100 * 5 + (units - 100) * 10
else:
    amount = 100 * 5 + 150 * 10 + (units - 250) * 20
totalBill = amount + 75
print("Total water bill =", totalBill)

Worked examples

| Units | Slab-wise working | Amount | + Meter 75 | Total bill |

|---|---|---|---|---| …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.