Flowcharts

Preview:

DESCRIPTION

What is a flowchart, advantages, disadvantages, exercises

Citation preview

Flowcharts

Mukesh N. TekwaniIsmail Yusuf College of Arts, Science and Commerce,Jogeshwari (East),Mumbai

tekwani@email.com

Presented at the One Day Workshop Organized by K.P.B. Hinduja College of Commerce, University of Mumbai on the

Semester-wise split T.Y.B.Com and S.Y.B.Com Computer papers on

July 20, 2013

April 12, 2023

What is a Flowchart?What is a flowchart?

◦Graphical or pictorial representation of an algorithm or problem solving process

Flow?◦Indicates the flow of logic, or sequence

of steps. ◦There is a ‘before’ step and an ‘after’

step◦Flow control is needed because

programs are not linear or top-to-down

Mukesh N. Tekwani 2

April 12, 2023

Why flowchart is useful?

A picture is worth a thousand words

Help in understanding complicated logic

Language-independent and so easy to

write program in various languages

Good tool for documentation

◦ Verbose syntax of certain languages is difficult

to understand; flowchart eliminates the need

to know syntax to understand the logic

Mukesh N. Tekwani 3

April 12, 2023

What can a Flowchart Represent?Sequential statements – assignment,

calculations, input & output

Branching or Selection Statements – if-

then, if-then-else: using Decision Symbol

Looping Statements – for, while loops

Switch-Case statement (successive

decision symbols)

Mukesh N. Tekwani 4

April 12, 2023

Symbols used in Flowcharts

Mukesh N. Tekwani 5

April 12, 2023

Guidelines in Drawing a FlowchartLogical sequence

Standard symbols

Direction of flow top-to-down

◦To jump to a step further down, go

from right

◦To jump to a step above the current

step, go from left

Mukesh N. Tekwani 6

April 12, 2023

Guidelines in Drawing a FlowchartOnly one flow line should enter a decision

symbol

More than one flow line may leave a

symbol

Only one flow line used with Stop symbol

Use connector symbol to breakup a

complex flowchart

A flowchart must end with the Stop

statementMukesh N. Tekwani 7

April 12, 2023

Flowchart of ‘while’ loop

Mukesh N. Tekwani 8

April 12, 2023

Flowchart of ‘for’ loop

Mukesh N. Tekwani 9

April 12, 2023

Flowchart of ‘if’ statement

Mukesh N. Tekwani 10

April 12, 2023

Flowchart of ‘if-else’ statement

Mukesh N. Tekwani 11

April 12, 2023

Flowchart of ‘switch-case’ statement

Mukesh N. Tekwani 12

April 12, 2023

Sum of Two Numbers

Mukesh N. Tekwani 13

April 12, 2023

START

INPUT X, Y

Is X > Y ?

BIG = X

Yes

PRINT BIG

BIG = Y

STOP

No

Larger Of Two Numbers

Mukesh N. Tekwani 14

April 12, 2023

Factorial of a Number

Yes

START

Read N

F = 1M = 1

IsM = N?

F = F * M

Print F

NoM = M + 1

STOP

Assume:N no. whose factorial is required

Mukesh N. Tekwani 15

April 12, 2023

Multiplication Table of a

number

input by user Mukesh N. Tekwani 16

April 12, 2023

Flowchart – Find the Largest of Three Numbers

Mukesh N. Tekwani 17

April 12, 2023

Limitations of FlowchartsComplex – for lengthy algorithms,

flowchart can be very large difficult to

follow

Time-consuming – drawing complex

flowcharts can be very time-consuming

Modification – difficult to modify; redraw

entire flowchart

Update – program update is easier; not so

for flowcharts redraw flowchart !Mukesh N. Tekwani 18

April 12, 2023

ExerciseDesign an algorithm and the

corresponding flowchart for finding the sum of the numbers 2, 4, 6, 8, …, n

Draw a flowchart to read 100 numbers and then display the sum

Draw a flowchart to display all odd numbers between 0 and 1000

Draw a flowchart to find the sum of first 10 natural numbers and then display the sum

Mukesh N. Tekwani 19

April 12, 2023

SuggestionsAlgorithm Flowchart Program

Use programs in C language to

develop questions on Algorithms

and Flowcharts

Mukesh N. Tekwani 20

April 12, 2023

THANK YOU

STOP

Mukesh N. Tekwani 21