Loading...
Loading...
Loading...
The electricity board charges by slabs:
There is also a fixed meter charge of ₹50, even when no units are used. Read the units used and print the bill.
Bill: X, where X is the total in rupees.Example 1
Input
150
Output
Bill: 600
100 × 3 + 50 × 5 + 50 (meter) = 600.
Example 2
Input
350
Output
Bill: 2050
300 + 500 + 150 × 8 + 50 = 2050.
Try the problem first. Open one hint at a time.
Each slab rate applies only to the units inside that slab, not to all the units.
The cost of a full first slab is 300 and of a full second slab is 500. For more than 200 units, the bill is 300 + 500 + (units − 200) × 8.
Write one branch for each range of units and add the meter charge at the end.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor