C Program to check whether input number is positive or negative

Here is simple to check whether input number positive or negative. If number is less then 0 then it is negative other wise it is positive number.
#include<stdio.h>
int main()
{
 int n;
 printf("Enter a number: ");
 scanf("%d",&n);
 if(n>=0)
 {
  printf("%d is positive number \n",n);
 }
 else
 {
  printf("%d is negative number \n",n);
 }
 return 0;
}


Popular posts from this blog