#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; }
Enter a number: 10 You entered a positive number.
This program takes a number from the user and checks whether that number is either positive or negative or zero.