Page 57 - PortGPT_V2.1_C6_Flipbook
P. 57

Advantages of flowchart
                    Provides an approach towards solving a problem and brings visual clarity to a problem.
                    Building a flowchart means doing a kind of documentation of the code you are about to
                     build.
                    Easy to understand the logic/ debugging process of a given problem.



                                                                                                       Critical Thinking
                  Example 1:  Draw a flowchart to calculate profit and loss.
                  (Refer Example 1 for algorithm)



                 Solution:


                                                 Start



                                               Read cost
                                               Price (C.P.)



                                              Read selling
                                               Price (S.P.)





                                                                  Yes
                                                S.P.>C.P.                   Profit = S.P. – C.P.


                                                     No

                                            Loss = C.P. – S.P.                 Print Profit



                                               Print Loss



                                                  End



                                                                                                       Critical Thinking
                  Example 2: Draw a flowchart to print 'Above average marks' if

                  the average marks in the three subjects are greater than 60 and
                  'Below average marks' if the average marks are less than or equal
                  to 60. (Refer Example 2 for algorithm)




                                                                                       Algorithms with Block Coding  55
   52   53   54   55   56   57   58   59   60   61   62