C Program To check Whether a Number is Positive, Negative or Zero
In this program, you will take integer input from the user and check whether the number is positive, negative, or zero.
Check Positive, Negative or Zero using Nested if...else
#include<stdio.h>
int main()
{
int a;
printf("enter the number:");
scanf("%d",&a);
if(a>0)
printf("%d is positive",a);
else if(a<0)
printf("%d is negative",a);
else
printf("%d is zero",a);
return 0;
}
output
run:1 enter the number:5 5 is positive Run:2 enter the number:-4 -4 is negative Run:3 enter the number:0 0 is zero