Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Pseudocode

Pseudocode is an informal high-level description of the operating principle of a computer program or


an algorithm.

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.

Basic rules before writing pseudocode:

 Write only one statement per line.

 Write what you mean, not how to program it

 Give proper indentation to show hierarchy and make code understandable.

 Make the program as simple as possible.

 Conditions and loops must be specified well.

Example 1:

WRITE A PSEUDOCODE TO FIND THE LARGEST OF TWO NUMBERS.

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

You might also like