Flowcharts&Pseudocode
Flowcharts&Pseudocode
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Agenda
In this session, we will discuss:
● Introduction to Flowcharts
● Uses of Flowcharts
● Elements of Flowchart
● Designing Flowchart
● Types of Flowchart
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
What is a Flowchart?
● A flowchart is a graphical representation of a process
or algorithm.
● It uses different shapes and arrows to show the
sequence of steps involved in completing a specific
task or solving a problem.
● Flowcharts are widely used in various fields:
o Including computer programming
o Business process analysis
o Engineering
o Education
o To visually illustrate complex processes or
problems
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Elements of a Flowchart
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Elements of a Flowchart
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Flowchart
● Algorithm to add two numbers: Fig: Flowchart to represent
o Step 1: Start the problem. Start the addition of two numbers
o Step 2: Read the values of A and B.
o Step 3: Find the sum of entered
Read A , B
numbers A and B and store the
result in C.
o Step 4: Print C. C=A+B
o Step 5: Stop the problem.
Print C
Stop
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Flowchart
● Algorithm to multiply two numbers: Fig: Flowchart to represent
o Step 1: Start the problem. Start the multiplication of two
o Step 2: Read the values of A and B. numbers
o Step 3: Find the product of entered Read A , B
numbers A and B and store the result
in C.
o Step 4: Print C. C = A*B
o Step 5: Stop the problem.
Print C
Stop
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Flowchart
● Algorithm to find largest of two Start Fig: Flowchart to represent
numbers: the largest of two numbers
o Step 1: Start the problem.
o Step 2: Read the values of A Read A , B
and B.
o Step 3: Compare A and B.
o Step 4: If A > B go to step 6. False True
o Step 5: Print B is Greater and
If A > B
go to step 7.
o Step 6: Print A is Greater. B is Greater A is Greater
o Step 7: Stop.
Stop
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Designing Flowchart
● Algorithm to Swap two numbers: Fig: Flowchart to represent
o Step 1: Start the problem. Start swapping of two numbers
o Step 2: Input the values of a and b.
o Step 3: c = a Read a , b
a=b
b=c
o Step 4: Print a, b. c=a
o Step 5: Stop the problem. a=b
b=c
Print a, b
Stop
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Types of Flowchart
● Process Flowchart
● Decision Flowchart
● Data Flow Diagram
● Linear Flowchart
● Workflow Diagram
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Process Flowchart
● The process flow chart provides a visual representation of the steps in a process.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Decision Flowchart
● Decision making flowchart is a systematic procedure for solving a problem.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Data Flowchart
● Data Flow Chart provides a visual representation of the flow of information (i.e. data) within a system.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Linear Flowchart
● A linear flowchart is used to show the sequential order of events in a process.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Work Flow Diagram
● A workflow diagram is a type of flowchart that serves as visual representation that shows you the
workflow of your business.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Summary
Here’s a brief recap:
● A flowchart is a visual representation of a process or a series of steps in a clear and organized manner.
● Flowcharts employ a range of shapes to visually convey the information.
● Different types of flowcharts come with different shapes, each serving a unique purpose.
● Designing a flowchart and converting the algorithms to their corresponding flowcharts.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Introduction to Pseudocode
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Agenda
In this session, we will discuss:
● Basics of Pseudocode
● Guidelines for Preparing Pseudocode
● Benefits of Pseudocode
● Developing a Pseudocode
● Difference between Algorithm and Pseudocode
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
What is Pseudocode?
● A pseudocode is an informal method of writing programs in a form that humans can easily understand.
● It doesn’t matter in what language you write a pseudocode, all that matters is comprehension.
● In pseudocodes, you don’t have to think about semi-colons, curly braces, and syntax as well.
● It allows you to write instructions that follow a logical pattern without including all of the technical
details in it.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Guidelines for preparing Pseudocode
● Pseudocode should be enclosed by START (or BEGIN) and STOP (or END).
● Pseudocode should be very concise and so we have to ignore unnecessary details.
● Use statements like INPUT, READ, GET or OBTAIN to accept the data from user.
● Use statements like PRINT, DISPLAY, or WRITE to display the result or any message.
● Generally the used keywords are capitalized while developing the pseudocode.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Benefits of Pseudocode
● Pseudocode allows the designer to focus on main logic without having to be worried about
programming languages syntax.
● They are language independent.
● It helps the designer to express the logic in plain natural language.
● It eases the job of developer in writing the actual code using pseudocode.
● They are very concise which makes the modifications easy.
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Pseudocode - Example
● Pseudocode to add two numbers:
BEGIN
NUMBER s1, s2, sum
OUTPUT("Input number1:")
INPUT s1
OUTPUT("Input number2:")
INPUT s2
sum=s1+s2
OUTPUT sum
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Pseudocode - Example
● Pseudocode to multiply two numbers:
BEGIN
NUMBER s1, s2, res
OUTPUT("Input number1:")
INPUT s1
OUTPUT("Input number2:")
INPUT s2
res=s1*s2
OUTPUT sum
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Pseudocode - Example
● Pseudocode to find largest of two numbers:
BEGIN
READ n1, n2
if n1 = n2
then print numbers are equal
if n1>n2
then print n1 is the largest number
if n2>n1
then print n2 is the largest number
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Pseudocode - Example
● Pseudocode to swap two numbers:
START
NUMBER a,b
set c=0
ca
ab
bc
then print a and b
STOP
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Difference between Algorithms and Pseudocode
Algorithms Pseudocode
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.