C Programming Code Examples C > If Else and Switch Case Code Examples Program to check whether the given integer is positive or negative Program to check whether the given integer is positive or negative In the following program we are checking whether the input integer number is positive or negative. If the input number is greater than zero then its positive else it is a negative number. If the number is zero then it is neither positive nor negative. Same logic we have followed in the below C program. #include <stdio.h> void main() { int j; printf("Enter a number: \n"); scanf("%d", &j); if (j > 0) printf("%d is a positive number \n", j); else if (j < 0) printf("%d is a negative number \n", j); else printf("0 is neither positive nor negative"); }