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

f.  Take a breakfast
                    g.  Take a lunch box
                    h.  Go to bus stand
                    i.  Take a bus
                    j.  Get off the bus
                    k.  Reach school or college
                15.  Write a pseudocode to calculate the factorial of a number ( Hint: Factorial of 5, written as 5! =5×4×3×2×1).
               Ans.   input num
                    product ← 1, i ← 1
                    while i <= num do
                        product ← product * i
                         i ← i + 1
                    end-while
                    print "factorial=", product
                16.  Draw a flowchart to check whether a given number is an Armstrong number. An Armstrong number of three digits is an integer such that
                    the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.
               Ans.

                                    Start





                                   Input n




                                   sum = 0
                                    m = n



                                      if          False            if          False          Print
                                    n > 0                       m = sum                   Not Armstrong
                                         True

                                   r = n % 10                    Print
                                   n = n / 10                 Armstrong
                                sum = sum + r 3

                                                                 Stop


                17.  Following is an algorithm to classify numbers as
                    "Single Digit", "Double Digit" or "Big".
                    Classify_Numbers_Algo
                    INPUT Number
                    IF Number < 9
                    "Single Digit"
                    Else If Number < 99
                    "Double Digit"
                    Else
                    "Big"
                    Verify for (5, 9, 47, 99, 100 200) and correct the algorithm if required


               114   Touchpad Computer Science (Ver. 2.0)-XI
   123   124   125   126   127   128   129   130   131   132   133