Page 72 - Computer Genius Class 06
P. 72

Pseudocode

                   seudocode  is  a  term   hich  is  o ten  used  in  programming  and  algorithm  ased  fields.   t  is  a
                  methodology that allows a programmer to represent the implementation of an algorithm.

                  In computer science, a pseudocode is used to describe the steps followed in an algorithm via simple
                  human comprehensible language.
                  Thus, it has no syntax of any programming language and can be easily understood.
                  Features of Pseudocode


                  l   Its uses structured English statements.

                  l   It can be reviewed or verified easily to see if it generates the desired outcome.

                  l   Writing pseudocode will help to write the main code easily.

                  l   All possible scenarios can be focused at single time.
                  Main Constructs of Peudocode

                  The pseudocode mainly uses  ords                            T   and   F T         . These
                  constructs are also called  ey ords and are used to descri e the control  o  o  the algorithm.
                  1.   SEQUENCE

                  It represents linear tasks, that are sequentially performed one after the other.
                  Example: washing clothes.
                  2.   REPEAT UNTIL

                   t repeats an action until a specified condition is met.
                  Example: mixing salad.

                  3.   REPEAT
                   t is used to repeat the tas   or a fi ed num er o  times.
                  Example: Cooking food.

                  4.   IF-Then-Else
                   t is a conditional statement that can change the  o  o  an algorithm.
                    ample     the  eather is cold  turn the  an off.  lse  turn it on.

                  Rules for Writing a Pseudocode

                  l   Always capitalise the initial word.

                  l   Keep the statements independent of any programming language.
                  l   Write only one statement per line.

                  l   Always move in an ordered way.

                  l   Keep it simple, concise and readable.
                  Example: Write pseudocode to print 'Above average marks' if the average marks in the three subjects
                  are greater than 60 and 'Below average marks' if the average marks are less than or equal to 60.



                       70    Computer Genius-VI
   67   68   69   70   71   72   73   74   75   76   77