Page 47 - iPlus_Ver_2.0_class_8
P. 47

Example  2:  Write  an  algorithm  and  draw  a                      Flowchart:
                 flowchart to check whether a given number is
                                                                                          Start
                 even or odd.

                 Algorithm
                 Step 1    Start                                                     Read a Number

                 Step 2    Read Number
                 Step 3    Check If Number % 2 == 0 Then
                           print "Number is Even."                                         Is

                           Else                                                      Number%2==0
                           print "Number is Odd."

                 Step 4    Stop
                                                                                    Yes            NO


                                                                        Number is even            Number is odd







                                                                                          Stop



                    Info Byte

                     Ada Lovelace is credited for the evolution of the concept of algorithm.







                    To Sum Up


                         A problem-solving technique is a collection of sequential steps to solve a problem.
                          An algorithm is a set of instructions or steps performed in a specific order to solve a
                        problem or to complete a task.

                          In computer terms, 'Algorithm is the sequence of steps or computer operations which
                        collectively solve a given problem'.

                          A flowchart is the graphical representation of a process and the logic (which is also called
                        an algorithm) used in it.
                         Flowcharts are used in a variety of fields to analyze, design, document, or manage a
                        process or program.

                         A  flowchart  uses  specific  geometrical  shapes  and  directional  arrows  to  represent  a
                        particular task.





                                                                                                                  45
                                                                                      Algorithms and Flowcharts
   42   43   44   45   46   47   48   49   50   51   52