Professional Documents
Culture Documents
1.4 Pseudocode
1.4 Pseudocode
The purpose of pseudocode is to express the logical steps of an algorithm. It uses a combination of
natural language and programming constructs, such as loop and conditional statements, to convey the
overall structure and intent of a program.
It is used as an intermediate step between a problem or task description, and the writing of actual code. It
can be used to plan the overall structure of a program, or to work out the details of a particular algorithm
or data structure.
The structure of pseudocode can be quite flexible, but it typically follows the basic format of a
programming language, with variables, assignments, control flow, and subroutines. The key difference is
that pseudocode doesn’t have to adhere to strict syntax rules and it can be written in natural language.
Example 1:
BEGIN
NUMERIC nNum1,nNum2
DISPLAY "ENTER THE FIRST NUMBER : "
INPUT nNum1
DISPLAY "ENTER THE SECOND NUMBER : "
INPUT nNum2
IF nNum1 > nNum2
DISPLAY nNum1 + " is larger than "+ nNum2
ELSE
DISPLAY nNum2 + " is larger than " + nNum1
END