C Program to Check Whether a Number is Positive, Negative or Zero

In this C program, we will learn about how to read a number and check whether number is positive, negative or zero. We will first take an integer as input from user using scanf function. Then we check whether input number is positive, negative or zero using if else ladder statement.

Required Knowledge


C program to check whether an integer is negative, positive or zero

#include <stdio.h>  
  
int main() {  
    int number;  
 
    printf("Enter a Number\n");  
    scanf("%d", &number);  
      
    if(number > 0) {  
        printf("%d is Positive Number", number);  
    } else if (number < 0) {  
        printf("%d is Negative Number", number);  
    } else {  
        printf("Input Number is Zero");  
    }  
    
    return 0;  
}
Output
Enter a Number
5
5 is Positive Number
Enter a Number
-3
-3 is Negative Number
Enter a Number
0
Input Number is Zero
Related Topics
C program to check whether a number is odd or even using switch statement
C program to check whether an alphabet is a vowel or consonant
C program to check year is leap year or not
C program to check whether three sides of triangle is valid or not
C program to check whether a triangle is equilateral, isosceles or scalene.
C program to check whether a triangle is equilateral, isosceles or scalene
C program to check a number is palindrome or not
List of all C programs