Explanation

471.Check Whether a Number Is Positive, Negative, or Zero

Easy
Given an integer n, determine whether it is positive, negative, or exactly zero, and return one of the strings "Positive", "Negative", or "Zero". This is the simplest possible introduction to multi-way branching: three mutually exclusive outcomes, decided by comparing a single value against 0. The if-else chainIf-Else ChainA sequence of if / else-if / else blocks, tried in order until one condition matches. version spells out each condition explicitly, which is the clearest way to learn the pattern. The ternaryTernary OperatorThe condition ? valueIfTrue : valueIfFalse expression — a compact, single-line alternative to a short if-else. version nests the same two comparisons into a single expression once that pattern feels natural.

Example 1:

Input: n = 7

Output: "Positive"

Example 2:

Input: n = -4

Output: "Negative"

Example 3:

Input: n = 0

Output: "Zero"

+ 4 hidden test cases run on Submit.

Constraints:

  • ●-1000 ≤ n ≤ 1000

n =

7