Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------------------------------------------------------
- // Exercise 2
- // ----------
- //
- // 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.
- //
- // Input : A number.
- //
- // Process : The program will look for the category which the number fits to, and print the appropriate message.
- //
- // Output : A message that descrbies the number.("Small","Big","Not big and not small" and "Rediculous")
- //
- //------------------------------------------------------------------------------------------------------------------------------
- // Programmer: Ohad Ozcohen
- // Date: 9.9.2016
- //------------------------------------------------------------------------------------------------------------------------------
- #include <stdio.h>
- typedef char bool;
- #define TRUE 1
- #define FALSE 0
- void main(void)
- {
- float num;
- bool FLAG = TRUE;
- printf("Please enter a number: ");
- scanf_s("%f", &num);
- if (num <= 3 && num >= 1)
- {
- printf("Small");
- FLAG = FALSE;
- }
- if (num <= 6 && num >= 4)
- {
- printf("Not big and not small");
- FLAG = FALSE;
- }
- if (num <= 10 && num >= 7)
- {
- printf("Big");
- FLAG = FALSE;
- }
- if (FLAG != FALSE)
- {
- printf("Rediculous");
- }
- }
Add Comment
Please, Sign In to add comment