Page 45 - iPlus_Ver_2.0_class_8
P. 45

Example 3: Flowchart to making a cup of tea.        Example 4: Flowchart of calculating the area
                                                                     of a circle.
                                   Start

                                                                                          Start
                           Collect kettle, teabags,
                           water, milk, sugar, cup
                                                                                    Read r (radius)
                         Boil the water in the kettle


                     Pour the boiling water into the cup                                Calculate
                                                                                   Area = 3.14 × r × r
                  Add milk, sugar and put a teabag in the cup

                                                                                       Print Area
                                Stir the tea


                               Tea is ready                                               Stop


                                   Stop                                   Flowchart to calculating the area of a circle.

                         Flowchart to making a cup of tea


                 Example  5:  Flowchart  to  finding  the  smaller   Example 6: Flowchart to displaying a series of
                 number between two numbers.                         numbers from 1 to 10.
                 There  comes  a situation where  we need to         A loop is a sequence of steps repeated  a

                 make a decision based on certain condition.         number  of times. We can  repeat  a group
                                                                     of  instructions  in  a  flowchart  until  a  specific
                                       Start
                                                                     condition is met.

                                 Read Num1 and
                                                                                       Start
                                      Num2

                                                                                      A = 1
                                        Is
                           Yes                      No
                                  Num1<Num2?

                   Print "Num1                      Print "Num2                         Is
                   is less than                     is less than                                    No
                                                                                     A<=10?
                     Num2"                            Num1"
                                       Stop
                                                                                          Yes
                       Flowchart to finding the smaller number
                                                                                     Print A
                               between two numbers.

                                                                                    A = A + 1         Stop

                                                                          Flowchart to displaying a series of numbers
                                                                                        from 1 to 10.


                                                                                                                  43
                                                                                      Algorithms and Flowcharts
   40   41   42   43   44   45   46   47   48   49   50