Skip to main content
Algorithm and Flowchart
1
Presented by: The Anonymous
BSc.CSIT 1st semester
What is algorithm ?
Properties of algorithm
What is flowchart ?
Merits of flowchart
Demerits of flowchart
Algorithm and Flowchart in Coding
References
Queries
2
What is an algorithm ?
Named after Persian mathematician Mohammad Al-
Khwarizmi
A sequential solution of any problem
Written in human understandable form
Requires a clear understanding of the problem
3
Example:
1. Algorithm for sum of two numbers
Step 1: Start
Step 2: Enter two numbers in a and b
Step 3: Add a and b and store in c
Step 4: Display c
Step 5: End
4
2. Algorithm to check whether the input number is
even or odd
Step 1: Start
Step 2: Enter a number in a
Step 3: Check if it is even or odd
Step 4: If even print “even” (a mod 2 = 0 )
Step 5: Else print “odd”
Step 6: End
5
Properties of algorithm
Finiteness
Properly defined
Input
Output
Effectiveness
Independent to any other programming language
6
7
Now moving on to next
programming tool
What is flowchart?
Diagrammatic representation of algorithm
An important programming tool
Solving a problem using figures
Different figures having different functions
8
Merits of flowchart
•Easy to explain program logic
•Makes coding effective and faster
•Effective communication
•Different symbols used
•Serve as documentation
•Easy to detect, locate and remove bugs in a program
9
Time consuming and monotonous job
Difficult to maintain
Occupies space while documentation
Translation to computer program is difficult
10
11
But what
might be the
symbols used
in flowchart?
Symbol Function Description
Start/End Start and end point
Input/output Input and output operations
Processing operation Editing and calculation of data
Decision Check logical condition
Connector Indicates logical flow from one
page to another
Direction of logic Direction of flow of logic
Comment Indicates any comments for
explanatory notes
12
Example 1: Flowchart add sum of two numbers
13
START
Input a and b
C = a + b
Display c
END
User can enter
any two numbers
Example 2: Flowchart to check whether the input number is
even or odd
14
START
Accept a number
Divide it by 2
END
Is remainder = 0 ?
Display odd Display even
YesNo
START
Accept a number
15
Using Algorithm and Flowchart in Coding
Coding
Enter numbers in a and b: 5
6
Displayed c: 11
References:
Websites:
google.com
wikipedia.com
linkedin.com
External sources:
Text book: Fundamentals of computer programming
16
Queries
17