Page 71 - Digicode_AI_class_6
P. 71

Rules to Draw Flowcharts                                                            Start

            You must follow these basic rules while drawing a flowchart:
                Maintain  the  direction  of  the  flow  from  left  to  right  or  top  to
                                                                                         Read P for Principal
               bottom.
                                                                                              r for rate
                Only one flow line should come out from a process box.                        t for time

               Only one flow line should enter a decision box, but two flow lines
            should leave the decision box.
                                                                                        Calculate
               Ensure that the flowchart has a logical start and end.
                                                                                        SI = (P * r * t)/100
            Look at the flowchart to calculate simple interest.


                                                                                               Print SI




                                                                                                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 weather 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
                                                                      Is
                                                                                 Yes
                                                               Number%2==0?
                     print "Number is odd."                                             Print Number is even
            Step 4   End.
                                                                        No


                                                             Print Number is odd



                                                                     Stop














                                                                                 Algorithmic Intelligence  69
   66   67   68   69   70   71   72   73   74   75   76