Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

587-X78

Algorithm &
Flowchart
Johnny Jean N. Tigas
Algorithm

Set of instructions / rules to be followed by a


computer program, which should contain an
INPUT,PROCESS and an OUTPUT, depending
on the problem to be solved.

Zamboanga City High


School
Variables
MATH:

A letter that can represent any number.

PROGRAMMING
:

A letter / word that serve as a temporary storage that can


represent any value.

Zamboanga City High


School
—Programming Problem
Create a program that will display the sum of 2 numbers
inputted by the user
—Algorithm:

1. Declare 3 variables,2 for the addends and 1 for the sum.


2. Let the user input the addends.
3. Perform the addition between the addends and assign it to the sum.
4. Display the sum.

Zamboanga City High


School
Flowchart

A method that allows a programmer to represent


the Algorithm in a Diagram or an Illustration.

Flowcharts represent the sequence of a


programming algorithm by using standard graphics
symbol that will represent the INPUT,PROCESS
and the OUTPUT.
Zamboanga City High
School
Basic Symbols
These symbols are the ones often used to create a diagram
that represents an algorithm that a computer program must
follow.

Start or
Input or Decision
End
Preparation Process Output

Ellipse Hexagon Rectangle Parallelogram Diamond

Zamboanga City High


School
Programming Problem:
Create a program that will display the sum of 2
numbers inputted by the user.

Pseudocode:
Let numOne=0,numTwo=0,and sum=0
Input numOne and numTwo
sum= numOne + numTwo
Ouput sum

Zamboanga City High


School
587-X78

Flowchart: Start

numOne=0
numTwo=0
sum=0

INPUT
numOne,
numTwo

sum = numOne + numTwo

OUTPUT
sum

End Zamboanga City High


School
—Programming Problem
Create a program that will display the average of 2 numbers
inputted by the user.
Pseudocode 1: Pseudocode 2:
Let numOne=0,numTwo=0,sum=0 and ave=0 Let numOne=0,numTwo=0,and ave=0
Input numOne and numTwo Input numOne and numTwo
sum= numOne + numTwo ave= (numOne + numTwo)/2
ave =sum/2 Output ave
Output ave

Zamboanga City High


School
587-X78

Flowchart: Start

numOne=0
numTwo=0
ave=0

INPUT
numOne,
numTwo

ave = (numOne + numTwo)/2

OUTPUT
ave

End Zamboanga City High


School
—Programming Problem
Create a program that will display “even” or “odd” depending on the
number inputted by the user.
Pseudocode:
Let num=0
Input num
If num is an even number
Output “even number”
If num is an odd number
Output “odd number”

Zamboanga City High


School
587-X78

Flowchart: Start

num=0

INPUT
num

YES NO
OUTPUT Is num OUTPUT
Even even? Odd

End Zamboanga City High


School
JOHNNY JEAN N. TIGAS
Zamboanga City High
School

587-X78
587-X78

Zamboanga City High


School

You might also like