Page 128 - Computer - 5
P. 128

The revised algorithm and flowchart to make a telephone call to your friend are:


                             Algorithm                                             Flowchart

           Step 1: Pick up the mobile phone.                                           Start


           Step 2: Open the dialler app.                                     Pick up the mobile phone

           Step 3:  Dial the phone number of your                               Open the dialler app
                     friend.                                                  Dial the phone number


           Step 4:  If the dialed number is busy, go                                     Is
                     to Step 5.                                                   the dialled number   Yes
                                                                                       busy?
                     Else, talk when someone answers.                                     No

           Step 5: End the call.                                            Talk when someone answers

                                                                                    End the call


                                                                                        Stop


                   Knowledge Discovery                                                             Subject Enrichment

               A Decision box always divides a flowchart into two parts. As the number of decision boxes
               in the flowchart increases, the different paths the flowchart takes may also increase. But
               they all must end before the Stop box.

          Example 4: Write an algorithm and draw a flowchart to find the smaller of two
          numbers A and B.


                          Algorithm                                             Flowchart
           Step 1: Read the two number A and B.                                    Start



           Step 2:  If A = B, display ‘Both numbers                            Read A and B

                     are equal’, else                                            Is A = B?   Yes


           Step 3:  If A < B, display ‘A is smaller’,                                 No              Print

                     else display ‘B is smaller’.                          No     Is A < B?    ‘Numbers are equal’

                                                                                      Yes
                                                                   Print
                                                                                    Print
                                                               ‘B is smaller’   ‘A is smaller’


                                                                                    Stop


              126
   123   124   125   126   127   128   129   130   131   132   133