Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 70 - 2615_KEC
P. 70

    DISPLAYING A SERIES OF NUMBERS FROM 1 TO 10
                      A loop is a sequence of steps that is repeated a number of times. In a flowchart, one or more

                      instructions can be repeated until a specific condition is met.

                                      Start

                                   Read A = 1

                                        Is
                                     A<=10?           No                                      21 st
                                                                                           Century   #Flexibility
                                                                                             Skills
                                                                        “Always draw a neat and clean
                                                                        flow chart, so that viewer can
                                          Yes
                                     Print A                            understand easily.”

                                    A = A + 1             Stop

                      SOLVING PROBLEMS USING ALGORITHMS AND FLOWCHARTS

                      Some examples are given below to solve the problems using algorithms and flowcharts:
                      Example 1: Write an algorithm and draw a flowchart to check whether a given number is even

                      or odd.
                      Algorithm:                                            Flowchart:

                      Step  1   Start.
                                                                               Start
                      Step  2   Read Number.

                      Step  3   Check If Number % 2 == 0 Then
                                                                         Read a Number
                                print "Number is even."

                                Else
                                print "Number is odd."                          Is            Yes
                                                                         Number%2==0?              Print Number is even
                      Step  4   Stop.

                                                                                  No

                                                                       Print Number is odd

                                                                               Stop

                       68   Premium Edition-VI

| 65 66 67 68 69 70 71 72 73 74 75 |