|
U
Pro2. Check Sign of Integer
Easy
Problem Description
Given an integer N, determine whether it is positive, negative, or zero.
Input Format
A single line containing an integer N.
Output Format
Print Positive if N>0, Negative if N<0, or Zero if N=0.
Example 1:
Input:
42
Output:
Positive
Explanation: 42 is strictly greater than 0, so it is Positive.
Example 2:
Input:
-17
Output:
Negative
Explanation: -17 is strictly less than 0, so it is Negative.
Example 3:
Input:
0
Output:
Zero
Explanation: 0 is neither positive nor negative.
Constraints:
-10^9 <= N <= 10^9Time complexity target: O(1)Auxiliary space target: O(1)
Follow up:How would you classify numbers with floating-point tolerance (epsilon)?
1,180 Online
Code
|Loading Code Editor...
SavedLn 1, Col 1
input =
Sandboxed Engine
Ctrl+Enter = Run | Ctrl+Shift+Enter = Submit