How to Write Pseudocode?

By | May 14, 2022
How to Write Pseudocode

In this article, we will discuss how to write pseudocode? Continue reading.

Pseudocode is a mix of technical terms and common English that facilitates computer programmers to write computer algorithms. Before diving into how to write pseudocode, let’s first discuss what pseudocode is and why do we need it.

What is Pseudocode?

pseudocode is the plain English representation of a computer program or algorithm, which specifies the flow and operation of the program.

It is generally used to represent the structural flow of a program, and it is not associated with any specific programming language. The same quality makes it a perfect tool to represent algorithms for various problems.

Some significant points you need to know about pseudocode are:

  • It is not a programming language.
  • It is just a learning and reasoning tool, which is used by programmers and developers to underline how to write the actual code.
  • Pseudocode can not be executed or compiled by any compiler, interpreter, or assembler.
  • Unlike programming language code, pseudocode does not follow a strict structure and syntax. Here, the programmer can write the code syntax as he pleases.


Code to check  if the user entered number is odd or even:

C++ Programming

int main()
int num;
cout<<"Enter a number";

    cout<<"Even Number";

    cout<<"Odd Number";


num :INPUT “Enter a number”
IF num MOD 2 ===0
    print “Even Number”
    print “Odd Number”

Why Use Pseudocode?

Before building anything, we first need to create a blueprint that describes all the methods, strategies, flow of the structure, and the resulting interface of the actual project.


Developers and programmers follow the same concept before they start writing the code for their projects, but here instead of the blueprint, the developer uses pseudocode to represent what approach and structure the actual program will follow.

The syntax of every programming language varies, which makes it hard to understand the implemented algorithm by studying the code. But pseudocode provides a solution for this.

With the help of pseudocode, we can write an algorithm using simple English. It allows a specific programming language developer or programmer could to understand the logic of the program and implement it in a specific programming language.

With pseudocode, we deal with the actual logic and the basic operations provided by every programming language. While writing pseudocode, we focus on the atomic process and methods provided by every programing language, and based on those operations and methods we try to build an algorithm.

When we write pseudocode for an algorithm, there are several operations, operators, and methods that we can use. In the section below, we mention only those which are common to every programming language.


How to Write Pseudocode?

As pseudocode does not follow a strict systematic or standard way of being written, so don’t think of writing pseudocode as a strict rule. However, there are some standard conventions that every programmer follows while writing one. These are:

  • Use capital words for reserved commands or keywords, for example, if you are writing IF…ELSE statements then make sure IF and ELSE be in capital letters.
  • Write only one statement per line.
  • Use indentation for the block body. It keeps the body of every component isolated and indenting different pieces of each block will indicate that those pieces of pseudocode go under a less intended section.
  • Be specific while writing a statement, use plain English to provide a particular description.

Pseudocode for Different Statements


1. Assignment Operator:

=, <- or :=

2. Comparison Operator:

== , !=, <, >, <= , and >=

3. Arithmetic Operator:

+,-, *, /, MOD(%)

4. Logical Operator:


5. Sum, Product:


Special Keyword:

  1. START: To begin the pseudocode.
  2. INPUT: Take input from the user.
  3. PRINT: To print the output on the screen.
  4. READ/GET: Input format while reading data from the file.
  5. SET, INIT: Initialize a value.
  6. INCREMENT, BUMP: Increase the value of the variable, equivalent to a++.
  7. DECREMENT: Decrease the value of the variable, equivalent to a–.
  8. COMPUTE, CALCULATE, DETERMINE: To calculate the expression result.

Conditional Statements:


IF condition
    THEN if body


IF condition THEN
    if body
    else body

if…else if….else

IF condition statement THEN
    if body
ELSE IF condition THEN
    else if statement
    else body

Example1 :

age = INPUT : “Enter your age”
IF age is greater than 18
    PRINT “adult”
    PRINT “Under age”

Example 2:

age = INPUT : “Enter Your age”

IF age is equal to 18 THEN
    PRINT “under check”
ELSE IF age is greater than 18
    PRINT “Give entry”
    PRINT “under age”


for loops:

FOR initial_value TO end_value
    for body


FOR i -> 0 to 20
    PRINT i

while loop

WHILE condition
    while body



i : 0
WHILE i  <= 20
    PRINT i


FUNTION function_name(parameters)
    function body
    RETURN value



FUNTION add( para1, para2 )
    result: para1+para2
    RETURN result

Write the FizzBuzz Algorithm Using pseudocode

FizzBuzz is a standard coding and interview problem, in which we write a code to print Fizz, Buzz, and FizzBuzz when the multiple of 3 and 5 occurs.

The problem states:

  • Write a code that prints each number from 1 to 30 in a new line.
  • Print “Fizz” if the number is the multiple of 3.
  • Print “Buzz” if the number is multiple of 5.
  • For number which is multiple of both 3 and 5 print “FizzBuzz.”

FizzBuzz Pseudocode

num : 1
FOR num -> 1 to 20
    IF num MOD 15 ===0
        PRINT “FizzBuzz”
    ELSE IF num MOD 3 ===0
        PRINT “Fizz”
    ELSE IF num MOD 5===0
        PRINT “Buzz”
        PRINT num

Equivalent Python Code:

for num in range(1, 21):
    if num % 15 ==0:
    elif num %3 ==0:
    elif num %5==0:

Advantage of Pseudocode

There are several advantages of leveraging pseudocode while developing computer programs and solving problems. Some of the most important ones are:

  • Increases the code readability.
  • Provides the best way to write algorithms.
  • More than specific syntax focuses on the program logic.
  • The best approach to represent how the actual program will be written.

How to Write Pseudocode as a Beginner

If you are a complete beginner in the programming world, just getting started with a new programming language, heard of Pseudocode, and wondering what this syntax is and how to write it. Don’t worry it is not a mandatory syntax it’s just a good coding practice, that many developers use before they get started on a project. Pseudocode is mostly used in a project algorithm discussion when developers prefer the common syntax of pseudocode to write the algorithm rather than writing it in a Programming language.

Pseudocode Examples for Beginner

Let’s discuss another pseudocode example that is more beginner-friendly. Suppose you need to write a program in C++ that can calculate the area of a rectangle. But before you implement the code in the programing language you want to write its pseudocode.

Pseudocode Example to calculate the area of a rectangle 

    length = INPUT: "Enter the length of the rectangle"
    width  = INPUT: "Enter the width of the rectangle"

    area = length * width

    OUTPUT area

Pseudocode to C++

Now let’s convert the above pseudocode to the equivalent C++ code.

#include <iostream>
using namespace std;

int main() {
    float length, width, area;
    cout<<"Enter the length of the rectangle: "; cin>>length;
    cout<<"Enter the width of the rectangle: "; cin>>width;
    area = width*length;
    cout<<"The area of the rectangle is "<<area;

Checkout more pseudocode examples to develop your pseudocode writing skills


There are no such strict rules to write pseudocode, and thus, the programmer can write it as she wishes, but it should be written in such a manner so that other developers could comprehend the algorithm.

All the examples and syntax we have mentioned here are conventional, and generally, most programmer follows the same syntax. If you want, you can modify the code to your liking.

In the above pseudocode examples, you can notice that for each component end, we use the END word. But if you want, you can replace it with { } curly braces.

If you like this article or have any suggestions, please let us know. We hope you learned something new from this.

This article presented you with the details of pseudocode and ways to write one. If you wish to learn more, you can buy a course for the same.

People are also reading:

8 thoughts on “How to Write Pseudocode?

  1. Tim Henwood

    some examples show ===0 and some show ==0. Are these typos or does 3 = have a different meaning than 2 =?

    1. Singh Post author

      Pseudocode does not have a rigid syntax and when it comes to comparison operator developer prefer to use different syntax.

      for example
      with if..else statement we can either use single (=), double (==) or triple equal to operator (===) and they all represent the same meaning (Comparison operator).
      IF (a=b) // comparison operator
      IF(a==b) // comparison operator
      IF(a===b) // comparison operator

      But in many cases when we want to find or store Boolean value by comparing two numbers there we can not use single equal to operator as a comparison operator. In that case we have to use double or triple equal to operator to represent comparison operator.
      a = b // assignment operator
      a==b // comparison operator
      a===b // comparison operator

      Many programming languages also support “===” comparison operator as strict equality operator that not only compare the value but also the data type of the operands. So insted of using double (==) operator programmer prefer using === operator for a proper comparison test.

      Thats why in many pseudocode example programmer use === operator as a comparison operator insted of == or =.
      === operator represent that you want a strict equality check. where as == or = operator can be confused with only data comparison test and assignment operator.

      1. tripti

        Plzz make a video of pesucode in there are many types of code which follows begginer to anvanced level
        And for me is really help if you uploaded video before 15 Jan 2021 ? please

  2. Graham Smallwood

    It’s cool that you agree that pseudocode isn’t strictly defined, and your text explanations are great. But your examples don’t follow your own text and I think they are actively wrong. The whole point (and you agreed) is to plan out the code before you start. But your examples of pseudocode ARE code. They are a made up language, but you have if-elses and whiles and stuff so it’s a coding language. If you are going to write the entire program, why not just actually start with the destination language?

    For pseudocode to be useful at all, it has to be done before any code. Like a plain english outline that you could read to someone else and they’d have enough information to write the program. It’s the problem solving step before the code step. Your examples just do two code steps in a row, so what’s the point?

    So I’m not trying to debate the meaning of the vague and meaningless word “pseudocode”, but I am pointing out that it needs to be useful or why do it.

    1. Singh Post author

      Thanks for your feedback. The Pseudocode syntax that I have mentioned in the article does incline toward programming languages syntax. This is because the final objective of a Pseudocode is how we can implement the algorithm in the programming languages. The debate on what is the absolute correct way to write a Pseudocode is never-ending. And I am appreciated by your response to this article.


Leave a Reply

Your email address will not be published.