Previous Next
0 / 18
Module DEMO-32-91DEMO-C-32

Jordan Water Bill Category

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

In Jordan, household water bills are often discussed using usage bands. For this exercise, classify a monthly water consumption value based on the following rules:

  • If the consumption is negative, the input is invalid.
  • If the consumption is from 0 to 10 cubic meters, print VERY_LOW.
  • If the consumption is from 11 to 20 cubic meters, print LOW.
  • If the consumption is from 21 to 35 cubic meters, print MEDIUM.
  • If the consumption is greater than 35 cubic meters, print HIGH.

Write a C program that reads one integer representing the monthly water consumption in cubic meters and prints the correct category.

This is a condition-based programming question. Use if, else if, and else statements to determine the result.

Constraints

-1000 <= n <= 1000 The input is guaranteed to fit in a 32-bit signed integer. Time limit and memory use are small enough that an O(1) solution is expected.

Input Format

The input contains one integer n, where n is the monthly water consumption in cubic meters.

Output Format

Print exactly one line:

  • INVALID if n < 0
  • VERY_LOW if 0 <= n <= 10
  • LOW if 11 <= n <= 20
  • MEDIUM if 21 <= n <= 35
  • HIGH if n > 35

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
8
VERY_LOW
8 is within the first valid range.
Sample #2
Public sample
15
LOW
15 falls in the second range.
Sample #3
Public sample
25
MEDIUM
25 is in the middle band.
Sample #4
Public sample
50
HIGH
50 is above the highest threshold.
Sample #5
Public sample
-3
INVALID
Negative consumption is invalid.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings