Selection Statements Questions
Selection Statements Questions
Q. Write pseudocode, program and draw flowchart that gives you a different
greeting
depending on the time of day you input in hours. The following conditions are
given:
● If hours are less than 12, displays good morning
● If hours are less than 18 but greater than 12, displays good afternoon
● If hours are less than 22 but greater than 18, displays good evening
● Otherwise displays good night.
Q. Write a program to input the age of a user. If the user is aged 21 or over, then
check his salary. If their salary is over 15,000 the flat rental is allowed, otherwise he is
informed that he doesn’t earn enough to rent the flat. If the user is aged 18 to 20, then a
guarantor is required. If he has a guarantor, he is told that the guarantor details are
needed, otherwise he is told that he must have a guarantor. Otherwise the user must
be under 18, so he will be informed that he can't rent the flat.
Q. Write a pseudocode to input number and find whether the entered number is odd or
even?
Q. Write pseudocode to take values of length and breadth of a rectangle from the user
and check if it is square or not.
Q. A shop will give a discount of 10% if the cost of the quantity purchased is more than
1000. Ask the user for quantity. Suppose, one unit will cost 100. Judge and print total
cost for the user.
Q. A student will not be allowed to sit an exam if his/her attendance is less than 75%.
Take following input from user:
● Number of classes held
● Number of classes attended.
● And print percentage of class attended
● Is a student allowed to sit in the exam or not?