KEMBAR78
Week 2 Introduction To Flowcharting and Algorithm | PDF | Algorithms | Theoretical Computer Science
0% found this document useful (0 votes)
7 views18 pages

Week 2 Introduction To Flowcharting and Algorithm

The document provides an introduction to flowcharting and algorithms, defining flowcharts as graphical representations of processes and algorithms as step-by-step procedures for problem-solving. It emphasizes the importance of algorithms in programming and outlines the components and significance of flowcharts, including their use for planning, documentation, and error detection. Additionally, it includes examples of algorithms and their corresponding flowcharts, illustrating how to convert algorithms into visual representations.

Uploaded by

Chowela Hallazgo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views18 pages

Week 2 Introduction To Flowcharting and Algorithm

The document provides an introduction to flowcharting and algorithms, defining flowcharts as graphical representations of processes and algorithms as step-by-step procedures for problem-solving. It emphasizes the importance of algorithms in programming and outlines the components and significance of flowcharts, including their use for planning, documentation, and error detection. Additionally, it includes examples of algorithms and their corresponding flowcharts, illustrating how to convert algorithms into visual representations.

Uploaded by

Chowela Hallazgo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Introduction to

Flowcharting and
Algorithm
Flowchart
A flowchart is a graphical representation of
an algorithm or process, using standardized
symbols and connecting arrows to illustrate
the sequence of steps, decisions, inputs,
outputs, and the flow of control.
Algorithm
A well-defined, step-by-step procedure or set
of rules designed to perform a specific task or
solve a particular problem.
In programming, an algorithm outlines the logic
and sequence of operations that a program
must follow to achieve a desired outcome.
It acts as a blueprint for writing code, ensuring
that the program performs its function correctly
and efficiently.
Pseudocode
A method to describe how an algorithm, process, or
program works using plain English. It helps outline the
steps to solve a problem before writing the actual code.
Algorithm typically consists of:

INPUT - The data or parameters the algorithm needs to process.

OUTPUT - The result or outcome of the algorithm after processing


the input.

STEPS - A finite steps of instructions that the algorithm follows to


transform the input into the output.

TERMINATION - The algorithm must have a clear end point, ensuring


that it does’nt run indefinitely.
Example of Simple Algorithm
Task : To find the largest of three numbers:
a. Start
b. Input three numbers: a ,b, and c.
c. If a is greater than or equal to a and b is
greater than or equal to c, then:
set max = a.
d. Elseif b is greater than or equal to a and b
is greater than or equal to c, then:
set max = b
e. Else
set max = c
f. Output max
g. End
Importance of Algorithm
1. Foundation of Problem-Solving
2. Efficient and Optimization
3. Reusability and Modularity
4. Debugging and Testing
5. Scalability
6. Framework for Learning New Concepts
7. Communication and Collaboration
8. Algorithm Analysis and Complexity
9. Application in Various Domains
Importance of Flowcharts
1. Visual Clarity
2. Simplification
3. Communication
4. Debugging and Analysis
Key Flowchart Symbol
and Their Meanings Diamond(Decision)
Function: Represents a decision
point where the flow can branch
based on a condition.
Oval (Terminator) Significance: This is where the
Function: Represents the start and end program or process makes a choice.
points of a flowchart
Significance: Marks where the process
begins and where it ends. Arrow(Flowline)
Function: Represents the direction
of flow from one step to the next.
Rectangle(Process)
Significance: Arrows connect the
Function: Represents the process, action,
symbols and show the sequence in
or operation in the flowchart.
which the steps are performed,
Significance: This symbol is used for steps
ensuring clarity in the process flow.
where something is done, such as
calculation, data processing or any other
operation. Circle(Connector)
Function: Used to connect parts of
Parallelogram(Input/Output) the flowchart when they are spread
Function: Represents data input or output. accross multiple pages or areas.
Significance: Indicates the points where Significance: Helps maintain the
the program interacts with external data flowchart’s readability by avoiding
or systems, such as taking input from the crossing lines or overcrowding the
user or displaying the output. diagram.
Components of a Flowchart
1.Start and End Points
Clearly marked using the oval terminator symbols indicating where the process begins and ends.
2. Processes
Representes by rectangles, showing each step or action in the sequence.
3. Decisions
Depicted by diamonds, illustrating points where a choice must be made, leading to different
brances in the flow.
4. Input/Output Operation
Shown with parallelograms, indicating where data is received or provided.
5. Flowlines
Arrows that connect the different steps and indicate the order in which they are executed.
6. Loops
Recurring processes or decisions can be presented by loops, where the flow returns to a previous
step based on certain conditions.
7. Annotations
Additional notes or comments can be added to clarify complex steps or decisions, often shown as
text beside the relevant symbol.
Why is Flowchat Significant?
Why is Flowchat Significant?
1.Planning and Design

2.Documentation

3.Error Detection

4.Education and Training

5.Process Optimization
Steps to Create Effective Flowcharts
1.Define the Purpose of the Flowchart
2.Identify the Process Steps
3.Choose the Appropriate Flowchart Symbols
4.Map Out the Flowchart Structure
5.Draw the Flowchart

1.Define the Purpose of the Flowchart 6.Review and Simplify

2.Identify the Process Steps 7.Add Notations and Labels

3.Choose the Appropriate Flowchart Symbols 8.Test the Flowchart

4.Map Out the Flowchart Structure 9.Make Revisions

5.Draw the Flowchart 10.Document and Distribute


Examples : Writing simple algorithms and converting them to flowcharts

Example 1: Algorithm to Find the Sum of Two Numbers.


Algorithm:
1. Start
2. Input the first number (num 1).
3. Input the second number (num 2).
4. Calculate the sum of num 1 and num 2 and store the result in sum.
5. Output the value of sum
6. End

Flowchart:
1. Start: Oval (Terminator)
2. Input num 1: Parallelogram (Input/Output)
3. Input num 2: Parallelogram (Input/Output)
4. Calculate sum = num 1 + num 2: Rectangle (Process)
5. Output sum: Parallelogram (Input/Output)
6. End : Oval (Terminator)
Examples : Writing simple algorithms and converting them to flowcharts

Example 1: Algorithm to Find the Sum of Two Numbers.


Algorithm:
1. Start
2. Input the first number (num 1).
3. Input the second number (num 2).
4. Calculate the sum of num 1 and num 2 and store the result in sum.
5. Output the value of sum
6. End

Flowchart:
1. Start: Oval (Terminator)
2. Input num 1: Parallelogram (Input/Output)
3. Input num 2: Parallelogram (Input/Output)
4. Calculate sum = num 1 + num 2: Rectangle (Process)
5. Output sum: Parallelogram (Input/Output)
6. End : Oval (Terminator)
Example 2: Algorithm to Find the Largest of Three Numbers
Algorithm:
1. Start
2. Input the three numbers (a, b, c)
3. If a >=b and a>=c
Output b a is the largest
4. Else if b >= a and b>=c
Output b is the largest
5. Else:
Output c is the largest
6. End

Flowchart:
1. Start: Oval (Terminator)
2. Input a,b,c: Parallelogram (Input/Output)
3. Decision 1: Diamond (Decision)
True Branch: Output a is the largest
4. Decision 2: Diamond (Decision)
True Branch: Output b is the largest
5. Else: Output c is the largest
6. End : Oval (Terminator)
Example 2: Algorithm to Find the Largest of Three Numbers
Algorithm:
1. Start
2. Input the three numbers (a, b, c)
3. If a >=b and a>=c
Output b a is the largest
4. Else if b >= a and b>=c
Output b is the largest
5. Else:
Output c is the largest
6. End

Flowchart:
1. Start: Oval (Terminator)
2. Input a,b,c: Parallelogram (Input/Output)
3. Decision 1: Diamond (Decision)
True Branch: Output a is the largest
4. Decision 2: Diamond (Decision)
True Branch: Output b is the largest
5. Else: Output c is the largest
6. End : Oval (Terminator)
Activity
Instructions: Read the problem statement. Then, write an algorithm step by
step and convert the algorithm into a flowchart using proper symbols.

Problem Statement
Create an algorithm and flowchart to calculate the average of three
numbers and determine whether the average is greater than or equal to 50
(Pass) or less than 50 (Fail).

Expected Output
If the average ≥ 50 → Display "Pass"
If the average < 50 → Display "Fail"

You might also like