1 of 2

ALGORITHM AND FLOWCHART

ALGORITHM AND FLOWCHART

Algorithm can also be defined as a procedure consisting of a series of steps which specify a sequence of operations that provides the solution to a problem.

An algorithm is a finite set of an instruction that specifies a sequence of operations to be carried out in order to solve a specific problem. It is a detailed sequence of simple steps that are needed to solve a problem.

Pseudocode is a detailed yet readable description of an algorithm, expressed in a formally-styled natural language rather than in a programming language. It is very similar to everyday English.

A flowchart is a pictorial representation of an algorithm in which the steps are drawn in the form of different shapes of boxes and the logical flow is indicated by interconnecting arrows.The boxes represent operations and the arrows represent the sequence in which the operations are implemented.

A flowchart is a diagrammatical representation of an algorithm.

Functions of algorithm

  1.    It provides a step-by-step solution to a problem
  2.     It is used to prove that a problem has a solution
  3.     It is used to give a sense of direction to the steps of solving a problem
  4.     It may also be used to show that a problem does not have a solution

Characteristics of an algorithm

  1.      Finiteness: it specifies an exact number of steps to be taken and has an end
  2.      Absence of ambiguity: it shows that every instruction is clearly and precisely specified
  3.       Sequence of execution: it shows how the instructions are performed from top to bottom
  4.      Effectiveness: it ensures that the solution prescribed is guaranteed to give a correct answer and that the specified process is faithfully carried out.
  5.      Input and output: these defines the unknowns of the problem specified and the expected output
  6.      Scope definition: it specifies precisely the problem or class of problem
  7.      Independence: algorithm is language independent

 ALGORITHM Examples

Example 1: Calculate the Interest of a Bank Deposit

Algorithm:

Step 1: Start

Step 2: Read amount,

Step 3: Read years,

Step 4: Read rate,

Step 5: Calculate the interest with formula “Interest=Amount*Years*Rate/100

Step 6: Print interest

Step 7: Stop

Example 2: Algorithm to Determine and Output Whether Number N is Even or Odd

Algorithm:

Step 1: Start
Step 2: Read number N,

Step 3: Set remainder as N modulo (divide) 2,

Step 4: If remainder is equal to 0 then number N is even, else number N is odd,

Step 5: Print output.

Step 6: Stop

Example 3: Algorithm to Print 1 to 20:

Algorithm:

Step 1: Start

Step 2: Initialize X as 0,

Step 3: Increment X by 1,

Step 4: Print X,

Step 5: If X is less than 20 then go back to step 2. Step 6: Stop