Page 101 - Computer Science Class 11 Without Functions
P. 101

As the variable i is used for indexing the computations, it is called an index variable. The steps mentioned as part of
            the for…end-for are executed for each value of the index variable in the range 2..nYears.
            Now we are ready to write a pseudocode to find out the maximum growth rate in the decade 2005-06 to 2014-15.
            input nYears = 10, growthRate[1..nYears]
            maxGrowthRate = growthRate[1]
            for i = 2 to nYears do
                if growthRate[i] > maxGrowthRate then
                     maxGrowthRate = growthRate[i]
            end-for
            print maxGrowthRate
            The flowchart representation of the above algorithm is as follows (Fig 4.10):

                                               Start


                                             nYears = 10


                                       inputGrowthRate[1..nYears]


                                     maxGrowthRate = growthRate(1)



                                                                       i = 2




                                                                     i<=nYears

                                           False                         True


                                                              growthRate(i) = maxGrowthRate


                                                                         True

                                                            maxGrowthRate = growthRate(i)


                                                                      i = i + 1


                                         print maxGrowthRate


                                               Stop
                                      Fig 4.10: Flowchart to compute maximum GDP growth rate in 10

            Next, suppose you are provided a list of the number of people living below poverty line in the twelve states where
            more than 20% people live below poverty line: Chhattisgarh, Jharkhand, Manipur, Arunachal Pradesh, Bihar, Odisha,
            Assam, Madhya Pradesh, Uttar Pradesh, Nagaland, Rajasthan, Meghalaya.  Based on the information provided, you
            are required  to compute the average population below the poverty line in these states. Let us denote the number of
            states by nStates and the population below the poverty line by a table named BPL. The individual population below
            the poverty line in twelve states is now denoted by BPL[1], BPL[2], …, BPL[12]. The population of the ith

            state is denoted by BPL[i].

                                                                                                Problem Solving  99
   96   97   98   99   100   101   102   103   104   105   106