Page 59 - Viva ICSE Computer Studies 8 : E-book
P. 59

Branched Flowchart
                                                                                         Start
                    Sometimes the fl ow of steps in an algorithm
                    can branch into multiple paths based on how a
                    particular condition works out. Branching is the                     Is it          Yes
                    process of following one or two or more alternate                   raining?
                    paths of computation. Let’s understand this with
                    an example. Suppose you have to leave home on                           No
                    any day in rainy season and you are wandering
                    about how to leave home.  You can choose to                 Leave umbrella at home
                    carry an umbrella with you if it is raining or you
                                                                                                        Take an umbrella
                    can leave the umbrella at home if it doesn’t rain.
                                                                                         Stop

                                                                                          A branched fl owchart
                            Do and Learn

                                                                                                      Flowchart
                       1.  Write an algorithm to find the area of a circle. Make a fl owchart for the same.
                            Steps to be Followed                                                         Start
                            Algorithm
                                                                                                         Read
                            Step 1: Start
                                                                                                          R
                            Step 2:  Radius (R) of a circle
                            Step 3:  Set Pi = 3.142                                                  Set Pi = 3.142

                            Step 4:  Area = Pi   R   R
                                             * *
                            Step 5:  Print the area.                                                Area = Pi  *  R  *  R
                            Step 6: Stop
                                Flowchart                                                             Display Area

                                  Start
                                                                                                         Stop


                               Input number                          2.   Write an algorithm to find whether the given
                                                                         number is even or odd. Also, make a flowchart
                                                                         for the same.
                             Rem = number/2                              Steps to be Followed

                                                                         Algorithm
                                                    False                Step 1: Start
                                Is Rem = 0                               Step 2:  Input the number

                                                                         Step 3:   If the number is divisible by 2, then print
                              True
                                                      Print ‘odd number’         that the number is even. Otherwise print
                            Print ‘even number’                                  that the number is odd.
                                                                         Step 4: Stop

                                                            Stop






                                                                                                                    47
   54   55   56   57   58   59   60   61   62   63   64