What is algorithm? Write the characteristics of an algorithm. Give an example for algorithm.

1 year ago
C Programming

Definition of Algorithm

Algorithm is a step by step solution to a given problem. Sequence of steps written in order to carry out some particular task. Each step of an algorithm is written in english.

Various charaterstics of an algorithm are

  1. The algorithm must have definite start and
  2. An algorithm may accept zero or more inputs
  3. An algorithm must produce atleast one output
  4. The steps of an algorihtm must be simple, easy to understand and unambigous.
  5. Each step must be precise and
  6. The algorihtm must contain finite number of

Example:

Algorithm 1: Algorihtm for finding of area of traingle

Step 1: start

Step 2: Read base and height of traingle Step 3: Calulate area of traingle

Step 4: print area of traingle Step 5: stop

Algorithm 2: Algorihtm for finding of sum and average of given three numbers

Step 1: start

Step 2: Read three numbers i.e. A, B and C

Step 3: find sum of three numbers i.e. sum=A+B+C

Step 4: find average of three numbers i.e. average=sum/3 Step 4: print sum and average

Step 5: stop

Sanisha Maharjan
Jan 20, 2022
More related questions

Questions Bank

View all Questions

Top