C Program to find positive negative or zero using If Else statement

Any number that is below zero is a negative number and above zero is a positive number. This program takes a number from console and checks if the number entered is a positive number, negative number or zero. To check this if else condition is used.


void main()
	int number;
	printf("Enter a number:\t");
	scanf("%d", &number);
	if(number > 0)
		printf("%d is a positive number\n", number);
	else if(number < 0)
		printf("%d is a negative number\n", number);
		printf("Number is zero\n");

Output 1

Enter a number:	54
54 is a positive number

Output 2

Enter a number:	-1
-1 is a negative number

Output 3

Enter a number:	0
Number is zero