Next
0 / 13
Module DEMO-32-56DEMO-C-32

Positive or Negative

DEMO-C-32 • Programming in C

Browser-only practice

Problem Statement

Write a C program that reads an integer from the user and determines whether it is positive, negative, or zero. If the number is greater than zero, print "Positive". If the number is less than zero, print "Negative". If the number is exactly zero, print "Zero".

Hint: Remember that zero is neither positive nor negative.

Constraints

-1000 ≤ n ≤ 1000

Input Format

The input consists of a single integer n on one line.

Output Format

Print exactly one of the following words based on the value of the input:

  • "Positive" if the number is greater than zero
  • "Negative" if the number is less than zero
  • "Zero" if the number is exactly zero

Sample Testcases

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

Sample #1
Public sample
5
Positive
5 is greater than zero, so the output is "Positive".
Sample #2
Public sample
-3
Negative
-3 is less than zero, so the output is "Negative".
Sample #3
Public sample
0
Zero
0 is neither positive nor negative, so the output is "Zero".

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