DEV Community

Cover image for Psuedocode
Zaynul Abedin Miah
Zaynul Abedin Miah

Posted on • Edited on

Psuedocode

A Pseudocode is defined as a step-by-step description of an algorithm. It's a human readable description of an algorithm. Algorithm is a sequence of steps we take to solve a particular code. The flowcharts we have drawn also represents algorithm. Pseudocode is the intermediate state between an idea and its implementation(code) in a high-level language.

Example:

*Calculating Prime numbers using Psuedocode *
Image description

  • First Read the value of N which can be any number.
  • Then choose a value for iterations for this you have to put the value of iterations i=2. It's because prime numbers are divisible by 1 and itself only.
  • we will use while loop for this problem, then iterate the value while it is i<N-1.
  • If the value is divisible by i it will enter into the curly brackets and will print not prime. If it isn't it will increment the i value while it is less than N-1 and will print prime if there aren't any value which is divisible between i and N-1.

Top comments (0)