Flowchart & Algorithm
Flowchart
Flowchart
Graphical/Pictorial Representation of the Program
Step by Step Solution
Flow of Data and Flow of Control
Important tool to identify the elements of the process
Helps to design the program before you start the coding
Symbols of Flowchart
Basic Flowchart
Symbols of
Flow Chart
Flowchart
Algorithm
Algorithm
A sequence of activities to be processed for getting
desired output from a given input.
A formula or set of steps for solving a particular problem.
Getting specified output is essential after algorithm is
executed.
One will get output only if algorithm stops after finite time.
Activities in an algorithm to be clearly defined in other
words for it to be unambiguous
Algorithm Ex -
Step1: Start
Step2: Read/input A and B
Step3: If A greater than B then C=A
Step4: if B greater than A then C=B
Step5: Print C
Step6: End
Algorithm Ex -
Step1: Start
Step2: Read/input the first num1.
Step3: Read/input the second num2.
Step4: Sum num1+num2 // calculation of sum
Step5: Print Sum
Step6: End
Algorithm Ex -
Step1: Start
Step2: Read/input A,B and C
Step3: If (A>=B) and (A>=C) then Max=A
Step4: If (B>=A) and (B>=C) then Max=B
Step5:If (C>=A) and (C>=B) then Max=C
Step6: Print Max
Step7: End
Algorithm Ex -
Problem1: An algorithm to calculate even
numbers between 0 and 99
1. Start
2. I ← 0
3. Write I in standard output
4. I ← I+2
5. If (I <=98) then go to line 3
6. End
Algorithm
and Flowchart
Algorithm and Flowchart
Problem Solving With Pseudocode
Pseudocode is a rough sketch to organize and
understand a program before it is written in codes.
The key difference between algorithms and
Pseudocode is that algorithms are more specific, while
Pseudocodes are more general
Easy to read; even non-programmers can understand it too
Structured, but not specific to any programming language
Used as a planning tool before writing any complex code
Pseudocode for addition of two numbers
Begin.
WRITE “Please enter two numbers to add”
READ num1.
READ num2.
Sum = num1+num2.
WRITE Sum.
End.
Pseudocode for addition of two numbers
BEGIN
NUMBER num1,num2,num3
INPUT num1
INPUT num2
INPUT num3
IF num1>num2 AND num1>num3 THEN
OUTPUT num1+ "is higher"
ELSE IF num2 > num3 THEN
OUTPUT num2 + "is higher"
ELSE
OUTPUT num3+ "is higher"
ENDIF