Positive number
All the numbers greater than 0, but not equal to 0 are positive numbers.
Negative number
Similarly all the number less than 0, but not equal to 0 are negative numbers.
Logic
If the number is greater than zero that means it is positive. If the number is less than zero that means it is negative. If the number is equal to zero that means it is absolute zero.
- if number > 0 then print Positive.
- if number < 0 then print Negative.
- if number == 0 then print Zero.
Program
#include <stdio.h> int main() { int number; printf("Enter any number : "); scanf("%d", &number); if(number > 0) { printf("\nPOSITIVE NUMBER."); } if(number < 0) { printf("\nNEGATIVE NUMBER."); } if(number == 0) { printf("\nNUMBER IS ZERO."); } return 0; }
Output
Enter any number : 101
POSITIVE NUMBER.