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
Characteristics of an algorithm
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