Skip to main content

Given number is +ve or -ve

#include <stdio.h>
int main()
{
  int n;
  printf("Enter a number\t:\t");
  scanf("%d", &n );
  if(n == 0)
    printf("\n%d is a neutral number", n);
  else
  if(n > 0)
    printf("\n%d is a positive number", n);
  else
    printf("\n%d is a negative number", n);

  return 0;
}

Enter a number :  -6

-6 is a negative number 

Comments