التالي
0 / 13
الوحدة النمطية DEMO-32-56DEMO-C-32

Positive or Negative

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

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.

قيود

-1000 ≤ n ≤ 1000

تنسيق الإدخال

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

تنسيق الإخراج

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

حالات اختبار نموذجية

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

العينة رقم 1
عينة ظاهرة
5
Positive
5 is greater than zero, so the output is "Positive".
العينة رقم 2
عينة ظاهرة
-3
Negative
-3 is less than zero, so the output is "Negative".
العينة رقم 3
عينة ظاهرة
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
إعدادات المحرر