Code Logo

Check Positive Negative Zero

Published at19 Apr 2026
Easy 0 views
Like0

This is a basic comparison problem. You are given one integer, and your task is to decide whether the value is above zero, below zero, or exactly zero.

If the number is greater than 0, print POSITIVE. If the number is less than 0, print NEGATIVE. If the number is exactly 0, print ZERO.

The goal is simply to check the value and return the correct label.

Example Input & Output

Example 1
Input
n = 0
Output
ZERO
Explanation

Because the value is exactly 0.

Example 2
Input
n = -3
Output
NEGATIVE
Explanation

Because -3 is less than 0.

Example 3
Input
n = 8
Output
POSITIVE
Explanation

Because 8 is greater than 0.

Algorithm Flow

Recommendation Algorithm Flow for Check Positive Negative Zero
Recommendation Algorithm Flow for Check Positive Negative Zero

Solution Approach

A clear way to solve this is to check the number in order.

First, read the integer. After that, compare it with 0.

If the number is greater than 0, print POSITIVE.

If it is not greater than 0, check whether it is less than 0. If yes, print NEGATIVE.

If neither condition is true, the number must be exactly 0, so print ZERO.

Best Answers

Solutions Coming Soon

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