Page 47 - IT_V5.0_Class8
P. 47

3.  Calculate the percentage.
                 4.  Display the percentage.
                 5.  If percentage is more than 90 then

                        Display award given
                    else
                        Display No award
                 Let us write some algorithm based on selection control structure.
                 Algorithm 6: Write an algorithm to input two numbers and display the larger one.
                 Step 1:   Start
                 Step 2:  Input NUM1 and NUM2.
                 Step 3:  If NUM1 > NUM2 then

                               Display NUM1 is greater than NUM2.
                           Else
                               Display NUM2 is greater than NUM1.
                 Step 4:  Stop
                 Algorithm 7: Write an algorithm to input a number and check whether it is positive, negative,
                 or zero.
                 Step 1:  Start

                 Step 2:  Input NUM.
                 Step 3:  If NUM > 0 then
                               Display NUM, is a positive number.
                           Else if NUM < 0 then
                               Display NUM, is a negative number.
                           Else
                               Display NUM, is 0.
                 Step 4:   Stop
                 Algorithm 8: Write an algorithm to input three numbers and display the smallest one.

                 Step 1:  Start
                 Step 2:  Input NUM1, NUM2, and NUM3.
                 Step 3:  If NUM1 < NUM2 and NUM1 < NUM3 then

                              Display smallest number: NUM1.
                           Else if NUM2< NUM1 and NUM2 < NUM3 then
                              Display smallest number: NUM2.
                           Else

                              Display smallest number: NUM3.
                 Step 4:  Stop
                 Algorithm 9: Write an algorithm to input a number and check whether it is even or odd.

                 Step 1:  Start
                 Step 2:  Input NUM




                                                                                       Algorithm and Flowchart   45
   42   43   44   45   46   47   48   49   50   51   52