Previous Next
0 / 15
Module DEMO-33-68DEMO-OOP-33

Sign Checker

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Write a function void checkSign(int n) that determines if a number is positive, negative, or zero.

If n is greater than 0, print "Positive".

If n is less than 0, print "Negative".

If n is 0, print "Zero".

Output should be followed by a newline.

Constraints

Integer values within standard range.

Input Format

A single integer.

Output Format

One of the strings: "Positive", "Negative", or "Zero".

Sample Testcases

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

Sample #1
Public sample
10
Positive
10 is greater than 0.
Sample #2
Public sample
-5
Negative
-5 is less than 0.
Sample #3
Public sample
0
Zero
The number is 0.

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