0% found this document useful (0 votes)
12 views

Week # 3 Flowcharts & Algorithms (Practice Examples)

Uploaded by

Frosty Galaxy
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Week # 3 Flowcharts & Algorithms (Practice Examples)

Uploaded by

Frosty Galaxy
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 12

FLOWCHARTS FOR ALGORITHMS

Algorithms and flowcharts are two different ways of presenting the


process of solving a problem. Algorithms consist of a set of steps for
solving a particular problem, while in flowcharts; those steps are
usually displayed in shapes and process boxes with arrows. So
flowcharts can be used for presenting algorithms.

Rules of Drawing Flowcharts for Algorithms


There are some basic shapes and boxes included in flowcharts that are used in the

structure of explaining steps of algorithms. Knowing how to use them while drawing

flowcharts is crucial. Here are some rules that should be known:

1. All boxes of flowcharts are connected with arrows to show the logical connection

between them,

2. Flowcharts will flow from top to bottom,

3. All flowcharts start with a Start Box and end with a Terminal Box,

Symbols Used In Flowchart


Different symbols are used for different states in flowchart, For example: Input/Output and decision
making has different symbols. The table below describes all the symbols that are used in making
flowchart

Symbol Purpose Description

Used to indicate the flow of logic by connecting


Flow line
symbols.
Symbol Purpose Description

Terminal(Stop/Start) Used to represent start and end of flowchart.

Input/Output Used for input and output operation.

Used for airthmetic operations and data-


Processing
manipulations.

Used to represent the operation in which there are


Decision
two alternatives, true and false.

On-page Connector Used to join different flowline

Used to connect flowchart portion on different


Off-page Connector
page.

Predefined Used to represent a group of statements


Process/Function performing one processing task.

EXAMPLES OF FLOWCHARTS FOR


ALGORITHMS

These examples will help you get a better understanding of flowchart techniques.

Example 1: Calculate the Interest of a Bank Deposit

Algorithm:
 Step 1: Read amount,
 Step 2: Read years,
 Step 3: Read rate,
 Step 4: Calculate the interest with formula "Interest=Amount*Years*Rate/100
 Step 5: Print interest,
Flowchart:

Example 2: Determine and Output Whether Number N is Even or Odd

Algorithm:

 Step 1: Read number N,


 Step 2: Set remainder as N modulo 2,
 Step 3: If remainder is equal to 0 then number N is even, else number N is odd,
 Step 4: Print output.
Flowchart:
Example 3: Determine Whether a Temperature is Below or Above the Freezing

Point

Algorithm:

 Step 1: Input temperature,


 Step 2: If it is less than 32, then print "below freezing point", otherwise print
"above freezing point"
Flowchart:
Example 4: Determine Whether A Student Passed the Exam or Not:

Algorithm:

 Step 1: Input grades of 4 courses M1, M2, M3 and M4,


 Step 2: Calculate the average grade with formula "Grade=(M1+M2+M3+M4)/4"
 Step 3: If the average grade is less than 60, print "FAIL", else print "PASS".
Flowchart:
Example 5: Draw a flowchart to add two numbers entered by user.
Example 6: Draw flowchart to find the largest among three different numbers
entered by user.
Example 7: Draw a flowchart to find all the roots of a quadratic equation
ax2+bx+c=0
Example 8: Draw a flowchart to find the Fibonacci series till term≤1000.
Though, flowchart are useful in efficient coding, debugging and analysis of a program,
drawing flowchart in very complicated in case of complex programs and often ignored.
OTHER WAYS OF FLOWCHARTING DESIGN &
EXAMPLE

You might also like