Writing An Algorithm

How to Write an Algorithm?

There are no well-defined standards or rules for writing algorithms. Rather, it is problem and resource dependent. Algorithms are never written to support a particular programming code. As we know that all programming languages share basic code constructs like loops (do, for, while), flow-control (if-else), etc. These common constructs can be used to write an algorithm.

Let’s try to learn algorithm-writing by using an example.

Problem – Write an algorithm to multiply two numbers and display the result.

step 1 – START

step 2 – declare three integers a, b & c

step 3 – define values of a & b

step 4 – multiply values of a & b

step 5 – store output of step 4 to c

step 6 – print c

step 7 – STOP

We design an algorithm to get a solution of a given problem. There can be more than one solution to solve the given problem.

Writing An Algorithm

Scroll to top