Number entered is positive, negative or zero using nested if-else
C program to check whether a number is positive, negative or zero using nested if-else.
Program
Output
Explanation
A number is taken as an input from the user and stored in the variable named say 'num'
First of all, condition
If true, then the number is either zero or a positive value. So, checked for both the cases one by one using another if else construct.
If false, then the number is a negative number.
First of all, condition
(num >= 0)
is checked.
If true, then the number is either zero or a positive value. So, checked for both the cases one by one using another if else construct.
If false, then the number is a negative number.