Pseudo code

November 16, 2021 Posted by Pasindu Sathsara

 Pseudo code 


  • Pseudo code is an informal way of programming description that does not require any strict programming language.
  • It is used for creating an outline or a rug draft about the program
  • Pseudo code summarizes a program’s flow.
  • Pseudo code is understood by programmers of all types.
  • It enables the programmer to concentrate only on the algorithm part of the code development.

Examples 01 :- 

  • Write pseudo code for software to input two numbers and display the result addition. 

            Sequence structure 

             START

                    DECLARE n1,n2

                    SET Total = 0

                    INPUT n1,n2

                    Total = n1 + n2

                    OUTPUT Total

            END

Examples 02 :- 

  • Write pseudo code for software to input a mark and display the grade
                75<= mark  A

                 65<= mark  B

                 55<= marks C

                 35<= marks  S

    Selection structure     

            START

                    DECLARE marks
                    
                    INPUT marks

                    IF mark => 75 then 
                    
                    PRINT ( "A")

                    ELSE IF marks =>65 then

                    PRINT ("B")

                    ELSE IF marks =>55 then

                    PRINT ("C")

                    ELSE IF marks =>45 then

                    PRINT ("S")
                    
                    ELSE

                     PRINT ("F")
        END

Examples 03:- 

  • Write a pseudo code for software to input a number and display it 3 times.                   

 Reputation structure 

            START

                DECLARE n,c

                SET C= 0

                INPUT n

                WHILE ( c<=3) then

                PRINT n

                    C= C+1

            END