You are on page 1of 3

Pseudocode

Learn what pseudocode is, what its benefits are, and how to describe a task in terms of
pseudocode.

We'll cover the following

• Why write pseudocode?


• Guidelines for writing pseudocode
• Example
• Pseudocode
• Explanation

Pseudocode is a description of the sequence of steps to be performed to solve a


problem in simple English-like language. Pseudocode is programming-language
independent. It is used by beginners and experienced programmers alike to
outline the solution of a problem before writing actual code.

Why write pseudocode? #

1. It is easy to translate pseudocode to


actual code in any programming
language for execution.
Pseudocode helps in:

2. Pseudocode makes it easy for 1. code translation


2. programmer
programmers proficient in collaboration
different programming languages 3. expressing the
solution
to collaborate in solving a problem.

3. It is easier for beginners to express


their solution in terms of
pseudocode since they do not have
to concern themselves with the
syntax of a particular
programming language.

Guidelines for writing pseudocode #


There are no fixed rules to adhere to while writing pseudocode. Each
individual may follow their own style of writing pseudocode. However, the
following are some general guidelines:

1. You can use mathematical symbols like +, %, >, etc.

2. You can use keywords like IF and ELSE.

3. You can indent statements to improve readability.

4. Write pseudocode in the order in which the tasks need to be performed.

5. Outline all the steps required to solve a problem down to the finest detail.

6. Write one action per line.

Write
You can use Indent Outline all Write one
You can use pseudocode
mathematical dependent the steps to step in one
keywords in the logical
symbols statement be performed line
order

General guidelines to write pseudocode

Example #
In the previous lesson, we learned to find the square of a number n. Let’s write the
solution in the form of pseudocode.

Pseudocode #

INPUT n
square = n * n
OUTPUT square 

Explanation #
We take n as input, i.e., we feed the value of n to the computer. * is the symbol
used for multiplication in programs, so we use it to find the square of n . Finally,
we report the square as the output, i.e., we display the value of square .

Back Next

Introduction to Problem-Solving Flowcharts

Mark as Completed

You might also like