Page 88 - TechPluse_C6_Flipbook
P. 88

Example 3: Write an algorithm and draw a flowchart to find the smallest in two numbers
                  A and B.

                  Algorithm:                                              Flowchart:
                  Step 1    Start.                                          Start
                  Step 2      Read two numbers and store them

                            in A and B.
                                                                        Read A and B
                  Step 3      Compare numbers A and B. If A is
                            less than B, then

                                  print "A is smallest"
                                                                              if
                                Else                                        A < B        Yes     Print A is smallest
                                print "B is smallest"

                  Step 4    Stop.                                               No


                                                                      Print B is smallest



                                                                            Stop


                  Example 4: Write an algorithm and draw a flowchart to check whether you are eligible for
                  driving licence or not.

                  Algorithm:                                        Flowchart:
                  Step 1    Start.

                  Step 2    Input Age                                   Start
                  Step 3     If age >= 18, print "ELIGIBLE"
                            Else, print "NOT ELIGIBLE"               INPUT AGE

                  Step 4    Stop.

                                                                                  NO
                                                                       IS AGE
                                                                                           DISPLAY "NOT ELIGIBLE"
                                                                       >=18?

                                                                            YES

                                                                  DISPLAY "ELIGIBLE"



                                                                         Stop













               86       Premium Edition-VI
   83   84   85   86   87   88   89   90   91   92   93