Page 87 - 2502_Pakistan-kifayat_C-7
P. 87

It is usually presented in a step-by-step format, with or without step numbers.

                     It should follow a logical path, i.e., take at least one input, process the input and produce the desired
                   output.
                    It must terminate after a finite number of steps.

                    It ends with the keyword “Stop”

                 Writing Clear Instructions

                 Clear instructions must be:

                    Easy to understand

                    In the correct order
                    Free from errors or confusion

                    Short and to the point

                    Logical and well-structured
                    Able to guide someone step-by-step

                    Written using simple language

                    Consistent in format and style

                 Example: Making a cup of tea.

                 1.  Boil water
                 2.  Place a teabag in a cup

                 3.  Pour hot water into the cup

                 4.  Wait for 2 minutes
                 5.  Remove the teabag

                 6.  Add sugar or milk if needed

                 7.  Stir and enjoy

                 Correct Algorithm

                 To write a correct algorithm:

                    Know the problem clearly.
                    Understand the inputs (what is given).

                    Know the outputs (what is expected).

                    Think logically step-by-step.
                    Break the problem into smaller tasks.

                    Arrange the steps in the correct order.

                    Check for any missing or repeated steps.



                                                                                                 #Logical Reasoning  85
   82   83   84   85   86   87   88   89   90   91   92