C Program to Check Whether a Number is Positive or Negative

To understand this example, you should have the knowledge of the following C programming topics:


This program takes a number from the user and checks whether that number is either positive or negative or zero.


Check Positive or Negative Using Nested if...else

You can also solve this problem using nested if...else statement.


Check Positive or Negative UsingĀ if...else Ladder


Output 1

Enter a number: 12.3
You entered a positive number.

Output 2

Enter a number: 0
You entered 0.