fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float num;
  5.  
  6. printf("Enter a number: ");
  7. scanf("%f", &num);
  8.  
  9. //crosscheck if number is positive, negative, or zero
  10.  
  11. if (num > 0) {
  12. printf("%.2f is a positive number.\n", num);
  13. } else if (num < 0) {
  14. printf("%.2f is a negative number.\n", num);
  15. } else {
  16. printf("You entered zero.\n");
  17. }
  18.  
  19. return 0;
  20. }
  21.  
  22.  
Success #stdin #stdout 0s 5240KB
stdin
Standard input is empty
stdout
Enter a number: 0.00 is a positive number.