Page 114 - Computer Science V2.0 Class 11
P. 114

Input:
                  nState: the number of states
                  BPL: list of population below poverty line
              Process:
                  Find the total population below poverty line
                  and divide by the number of states
              Output:
                  average population below poverty line
              The pseudocode representation of this algorithm is as follows:
              input nStates, BPL
              totalBPL = 0
              for i = 1 to nStates
                  totalBPL = totalBPL + BPL[i]
              end-for
              average = totalBPL / nStates
              print average
              The flowchart representation of the above algorithm is as follows (Fig 4.11):

                                                  Start



                                         input nStates, BPL[1..nStates]


                                               totalBPL = 0




                                                                               i = 1





                                                                             i<=nStates



                                              False                                True
                                                                       totalBPL = totalBPL + BPL[i]



                                                                              i = i + 1



                                           average = totalBPL/nStates


                                                print average



                                                   Stop

                               Fig 4.11: Flowchart to compute the total population and average of below poverty line


               100   Touchpad Computer Science (Ver. 2.0)-XI
   109   110   111   112   113   114   115   116   117   118   119