Algorithms:- 

An algorithm is an effective procedure for solving a problem in a finite
number of steps.It can be defined as “step by step representation of the solution of any
given problem .

  • The procedure has to be based on definite reasoning and logic to obtain a result.
  • A well- designed algorithm will always provide an answer.

Every algorithm has some of its characteristics these are:-

  1. Finiteness:-Total no. Of steps used in algorithm should be finite.
  2. Input&output:- every algorithm must accept zero or more input and produce atleast one output.
  3. Definiteness:- All steps of the algorithm must be precisely defined.
  4. Effectiveness:- it must be possible to perform each step of the algorithm correctly and in a finite amount of time. 

Advantages of algorithm

  • It is the step-wise representation of the solution t the given problem which makes its easy to understand.
  • An algorithm was a definite procedure it is independent on programming language so easy to understand for anyone without programming knowledge.
  • Easy step in algorithm has its own logic so it is easy to debug.
  • by using an algorithm the problem is broken down into smaller peaces or steps hence, it is easy for programmer to convert it into an actual problem.

Disadvantages of using an algorithm

  • writing algorithm takes a long time.
  • An algorithm is not a computer programmer it is rather a concept of how a program should be.

Algorithm Example

Write an algorithm to add two numbers.
Step 1- Start
Step 2- Read the value of n1 and n2.
Step 3- Sum=n1+n2..
Step 4- Display sum.
Step 5- Stop.