Page 5 - LN
P. 5

Lesson Note
























               Selection/Conditional Flow
               When you need to select from multiple options any one (based on certain condition)
               Example,
               (i) Checking eligibility for voting.
               Depending on their age, a person will either be allowed to vote or not allowed to vote:
               • If age is greater than or equal to 18, the person is eligible to vote
               • If age is less than 18, the person is not eligible to vote
               (ii) Checking if a number is even or odd
               • If remainder after dividing the number by 2 is 0, EVEN
               • If remainder after dividing the number by 2 is not 0, ODD


               Selection/Conditional Flow
               Here the program checks one or more conditions and perform operations (sequence of actions)
               depending on true or false value of the condition.
               These true or false values are called binary values.

               Conditionals are written in the algorithm as follows:
               If <condition> then
               steps to be taken when the condition is true/fulfilled

               There are situations where we also need to take action when the condition is not fulfilled. To
               represent that, we can write:
               If <condition> is true then
               steps to be taken when the condition is true/fulfilled
               otherwise/else
               steps to be taken when the condition is false/not fulfilled


               Draw a flowchart to find bigger number among two numbers
   1   2   3   4   5   6   7   8