Before I explain how to write an algorithm, you need to know what an algorithm is.
What is Algorithm?
An algorithm is a set of rules or a step-by-step procedure to solve a specific problem or a particular task.
Qualities of a Algorithm:
Input and output should be clearly defined.
Follow the proper step by step and each step should be clear.
Out of all the method to solving a problem, algorithms to be the most efficient.
Algorithm is not depend on any language, you can convert in any programming language.
Example : Calculate the average of three given numbers?
You need write a algorithm of above example
Step 1 : Start
Step 2 : Declare variables n1, n2, n3, sum and average
Step 3 : Read values n1, n2, n3.
Step 4 : Add n1, n2, n3 and assign the result to sum.
sum=n1+n2+n3
Step 5 : Divide sum by 3 and assign the result to average.
average = sum / 3.
Step 6 : Display average
Step 7 : Stop