Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Algorithm An algorithm is a sequence of a finite number of steps arranged in a specific logical order which, when executed produces the

e solution for a problem They have 2 type algorithm 1. Pseudocode is a semiformal ,English like language with a limited vocabulary that can be used to design and describe algorithms Example 1: Count the sum , average of 2 numbers Requirement specification Find the sum and average of 2 numbers Analysis i) Formula sum = number1 + number2 average = sum / 2 ii) input number1 , number2 iii) output sum , average Design Algorithm 1. 2. Input 2 numbers count

add 2 numbers count the average of 2 numbers 3. print sum and average

Example 2 :

Calculate the area of one circle Requirement specification Find the area of a circle Analysis i) formula area = PI * radius *radius ii) input radius, PI = 3.142 iii) Output area Design Algorithm 1. input radius 2. PI = 3.14 3. count the area by multiplying PI and radius * radius 4. Print area 2. Flowchart is a graph consisting of geometrical shapes that are connected by flow lines : - In order to use flowcharts to communicate algorithms, we must develop some conventions for its symbols - The basic flowchart symbols are the terminal, process, input-output and selection

Graphic symbol

Name and meaning Terminal symbol (oval) indicates the beginning algorithm Process symbol (rectangle) shows an instruction other than input output and end points of an

Input-output

symbol

(parallelogram)

shows an input or an output operation

Selection symbol (diamond) shows a selection process for two-way selection

On- page connector (circle) provides continuation of logical path at another points in the same page

Flow lines indicate the logical sequence of execution steps in the algorithm

You might also like