C Program to check if number is positive, negative or zero


Write a C Program to check if the number is positive, negative or zero using if-else statement. Check if the given number is positive, negative or zero in C language.

C Program to check if the number is positive, negative or zero.

#include <stdio.h>

void main()
{
    int num;
    printf("Enter the number: ");
    scanf("%d", &num);
    if(num == 0)
        printf("%d is Zero", num);
    else if(num > 0)
        printf("%d is Positive", num);
    else
        printf("%d is Negative", num);
}

Recommended Posts