Pseudocode is an informal high-level representation of the actual code that shows how an algorithm or a computer program works in plain English.
Writing pseudocode allows you to get those brilliant ideas in your head in front of you without having to worry about the syntax of the programming language. Since it has no specific syntax, it is easy to read and write, and programmers can comfortably communicate ideas and concepts, even if they are working on different programming languages.
Say you want to write a program that prints odd numbers from to .
Let’s start by writing it in simple pseudocode.
Remember, this code won’t compile and execute on its own.
set i to 0 for each i from 0 to 9 if i is odd print i end for loop
Note: Pseudocode does not have a specific syntax. Your pseudocode can look different from ours.
Pseudocoding may sound trivial to you, and you may want to jump right into coding, but it does make things a lot easier. Now, all you need to do is convert this plain English into actual code.
Here is the above pseudocode translated into C++, Python, and Java code:
#include <iostream>using namespace std;int main() {// Printing odd numbers from 0 to 9for (int i = 0; i <= 9; i++) {if (i % 2)cout << i << endl;}}