Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 89 - 2505_CoreGPT(Podar)_Flipbook_C6
P. 89

    Example 3: Write an algorithm and draw a flowchart to add first 100 natural numbers.

                                   Algorithm:                                             Flowchart:
                     Step 1  Start.
                                                                                             Start
                     Step 2  Let Sum = 0 and N = 0

                     Step 3  N = N + 1                                                   Sum = 0, N = 0
                     Step 4  Sum = Sum + N

                     Step 5  Check If N >= 100 then                                        N = N + 1
                              print Sum
                              Else                                                     Sum = Sum + N

                              Go to Step 3.
                     Step 6  Stop.                                                             Is
                                                                                    No       N >=
                                                                                             100?

                                                                                                 Yes

                                                                                           Print Sum

                                                                                             Stop

                            Restart

                            Algorithm is a set of steps in a sequential manner to solve a problem or to complete a
                          task.

                            Flowchart is a graphical representation of the sequence of operations in an information
                          system or program.
                            A  flowchart  uses  specific  geometrical  shapes  and  directional  arrows  to  represent  a
                          particular task.
                            The language used to write a program is called a programming language.

                                                              Checkpoint

                     A.  Tick ( ) the correct option.
                        1.  Which characteristic ensures that the algorithm stops after a limited number of instructions?

                           a.  Precision                                    b.  Uniqueness

                           c.  Finiteness                                   d.  Input

                                                                                           Algorithm and Flowchart       87

| 84 85 86 87 88 89 90 91 92 93 94 |