Code Logo

Check Water Bottle Empty

Published at19 Apr 2026
Easy 0 views
Like0

This problem is based on a simple daily check. You look at how much water is left in a bottle and want to know whether it is already empty.

If the amount left is exactly 0, print EMPTY. If the amount is more than 0, print HAS WATER.

For example, if the bottle has 0 milliliters left, the answer is EMPTY. If it still has 250 milliliters, the answer is HAS WATER.

So the task is to check one number and return the correct bottle status.

Example Input & Output

Example 1
Input
amount = 250
Output
HAS WATER
Explanation

There is still water left in the bottle.

Example 2
Input
amount = 1
Output
HAS WATER
Explanation

Any amount above zero means the bottle is not empty.

Example 3
Input
amount = 0
Output
EMPTY
Explanation

No water left means the bottle is empty.

Algorithm Flow

Recommendation Algorithm Flow for Check Water Bottle Empty
Recommendation Algorithm Flow for Check Water Bottle Empty

Solution Approach

A simple way to solve this is to compare the amount left with zero.

First, read the amount of water left in the bottle. After that, check whether the value is exactly equal to 0.

If the value is 0, that means nothing is left, so print EMPTY.

If the value is greater than 0, the bottle still has water, so print HAS WATER.

This problem is just one quick equality check, so the logic stays short and clear.

Best Answers

Solutions Coming Soon

Verified best solutions for this Challenge are still being analyzed and will be available soon.