Page 23 - CloudGPT_C8_Flipbook
P. 23

Characteristics of Pseudocode
                    It uses structured english statements.
                    It can be reviewed/verified easily to see if it generates the desired outcome.
                    You can focus on all possible scenarios. So, this helps you to understand the potential
                     problems that might come up later.

                    Writing pseudocode will help to write your code much easier.

                 Advantages of Pseudocode
                    It is language-independent and can be used by most programmers to express the design
                     in plain and natural language.
                    Programmers do not have to think about syntax, they simply have to concentrate on logic.

                    The focus is on the steps to solve a problem rather than how to use the computer
                     language.

                                                                                                       Interdisciplinary
                   Example 1:  Write pseudocode to calculate profit and loss.
                   (Refer Example 1 for algorithm and flowchart)


                 Solution:
                 Program Start
                 Read Cost price (C.P.)
                 Read Selling price (S.P.)
                 If (SP>CP) then

                        Profit = S.P.-C.P.
                        Print Profit
                 Else
                        Loss= C.P.-S.P.

                        Print Loss
                 Program End

                                                                                                       Critical Thinking
                  Example 2: 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. (Refer
                  Example 2 for algorithm and flowchart)


                 Solution:
                 Program Start

                 Read marks for subject Num1 (a)
                 Read marks for subject Num2 (b)

                                                                                 Algorithms with  Block Coding   21
   18   19   20   21   22   23   24   25   26   27   28