Page 48 - TP_iPlus_V2.1_Class8
P. 48

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 n

                  Step 2    Read the number n
                  Step 3    Check If n % 2 == 0 Then
                            print "Number is Even."
                                                                                            Is
                            Else                                                          n%2==0
                            print "Number is Odd."

                  Step 4    Stop.
                                                                                     Yes            No


                                                                         Print "Number is          Print "Number is
                                                                              Even."                    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.





                    46
                         iPlus (Ver. 2.1)-VIII
   43   44   45   46   47   48   49   50   51   52   53