Write a Program to Check Whether a Number is Positive or Negative

#include <stdio.h>
int main()
{
 double number;
 printf("Enter a number: ");
 scanf("%lf", &number);
 if (number <= 0.0)
 {
  if (number == 0.0)
   printf("You entered 0.");
  else
   printf("You entered a negative number.");
 }
 else
  printf("You entered a positive number.");
 return 0;
}

Output

Enter a number: 10
You entered a positive number.
 

Explanation

This program takes a number from the user and checks whether that number is either positive or negative or zero.