ohad

Untitled

Sep 8th, 2016
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //------------------------------------------------------------------------------------------------------------------------------
  2. //                                                                  Exercise 2
  3. //                                                                  ----------
  4. //
  5. // General : The program will get a number and it will print "Small" if the number is between 1-3, "Not big and not small" if the number is between 3-6, "Big" if the number is between 7-10 and "Rediculous" for any other option.
  6. //
  7. // Input   : A number.
  8. //
  9. // Process : The program will look for the category which the number fits to, and print the appropriate message.
  10. //
  11. // Output  : A message that descrbies the number.("Small","Big","Not big and not small" and "Rediculous")
  12.  
  13. //
  14. //------------------------------------------------------------------------------------------------------------------------------
  15. // Programmer: Ohad Ozcohen
  16. // Date: 9.9.2016
  17. //------------------------------------------------------------------------------------------------------------------------------
  18.  
  19. #include <stdio.h>
  20. typedef char bool;
  21. #define TRUE 1
  22. #define FALSE 0
  23.  
  24. void main(void)
  25. {
  26.     float num;
  27.     bool FLAG = TRUE;
  28.     printf("Please enter a number: ");
  29.     scanf_s("%f", &num);
  30.     if (num <= 3 && num >= 1)
  31.     {
  32.         printf("Small");
  33.         FLAG = FALSE;
  34.     }
  35.     if (num <= 6 && num >= 4)
  36.     {
  37.         printf("Not big and not small");
  38.         FLAG = FALSE;
  39.     }
  40.     if (num <= 10 && num >= 7)
  41.     {
  42.         printf("Big");
  43.         FLAG = FALSE;
  44.     }
  45.     if (FLAG != FALSE)
  46.     {
  47.         printf("Rediculous");
  48.     }
  49. }
Add Comment
Please, Sign In to add comment