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

In this program, we will check the number entered by user is Positive, Negative or Zero. We have used if statement to check a condition. If number is less than 0 then it is negative number, if it is greater than 0 then that is positive number otherwise it is zero.

Source Code
void main()
    int no;
    printf("Enter a number: ");
    scanf("%d", &no);

        printf("Number %d is positive",no);
    else if(no<0)
        printf("Number %d is negative",no);
        printf("Number is zero");
Enter a number: 5
Number 5 is positive

Enter a number: -21
Number -21 is negative

Enter a number: -0
Number is zero