Algorithm and Flowchat
Algorithm and Flowchat
Definition Algorithm
Algorithm can be defined as a set of rules and sequential steps that define how a particular problem can
be solved in finite and ordered sequences.
Function of Algorithms
An algorithm generally takes some input, carries out several effective steps in a finite amount of time,
and produces some output.
Characteristics of Algorithms
Example1: Write an algorithm to compute the area and circumference of a cycle given the diameter d.
Use the formular A= πr^2 and C= 2πr Solution
Step 1: Start
Step 2: Get the diameter d
Step 3: Compute r=(d/2)
Step 4: Compute A= πr^2
Step 5: Compute C= 2πr
Step 6: Display the results
Step 7: Stop
Definition of Flowchart
This is the graphical representation of the steps involved in solving a given problem. More formally, a
flowchart is a pictorial representation in which symbols are used to show the various operation and
decisions to be followed in solving a problem.
Some standard symbols used in drawing a program flow chart are:
i. Every flowchart must terminate, that is, it must have a starting and ending points.
ii. The Direction of flow should be from left to right or top to bottom.
iii. Maintain consistent spacing between symbols
iv. Use the correct symbol for each step
v. Keep it simple and clear.
Example 1: Draw a flow chart to print the area of a 10cm square