Instructional Module: Republic of The Philippines Nueva Vizcaya State University Bambang, Nueva Vizcaya
Instructional Module: Republic of The Philippines Nueva Vizcaya State University Bambang, Nueva Vizcaya
In this lesson you will learn what a flow chart is and why computer programmers use them
when developing new applications. You will also learn about common flow charts and see
examples of them.
V. LESSON CONTENT
1. Programming language is how we can talk to computers. It's a lot like English but it's
kind of quirky too. Unlike people, machines cannot guess our intent. We have to be
super meticulous and describe what we want in every little detail.
2. Types of Languages
There are three main kinds of programming language:
1
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Problem Definition
In this phase, we define the problem statement and we decide the boundaries of the problem. In
this phase we need to understand the problem statement, what is our requirement, what should
be the output of the problem solution. These are defined in this first phase of the program
Problem Analysis
In phase 2, we determine the requirements like variables, functions, etc. to solve the problem.
That means we gather the required resources to solve the problem defined in the problem
Algorithm Development
During this phase, we develop a step by step procedure to solve the problem using the
specification given in the previous phase. This phase is very important for program development.
2
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
This phase uses a programming language to write or implement the actual programming
instructions for the steps defined in the previous phase. In this phase, we construct the actual
program. That means we write the program to solve the given problem using programming
During this phase, we check whether the code written in the previous step is solving the specified
problem or not. That means we test the program whether it is solving the problem for various input
data values or not. We also test whether it is providing the desired output or not.
Maintenance
During this phase, the program is actively used by the users. If any enhancements found in this
phase, all the phases are to be repeated to make the enhancements. That means in this phase,
the solution (program) is used by the end-user. If the user encounters any problem or wants any
enhancement, then we need to repeat all the phases from the starting, so that the encountered
Input is the user giving something to the program. This are the things needed to accomplish
something like for example when you take a bath. Inputs needed to take a bath are soap, bath
towel, shampoo, water and pail.
Another example, if you want to display the SUM of 2 integer numbers. The inputs there are the
2 integer numbers that are represented by a variable x and y or any letter representing the 2
integer number.
Output is the program giving something to the user. This are the result of a process. For
example, in getting the sum of 2 integer number. The output there is the SUM of the given
inputs x and y.
So, the mathematical expression for that expression is SUM = x + y.
Note: In programming always remember that the left side of expression in the output and the
right side is the input.
OUTPUT
SUM = X + Y
INPUT
3
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Process is an execution of any specific program. It is considered an active entity that actions the
purpose of the application.
For example, If you are double click on your Google Chrome browser icon on your PC or laptop,
you start a process which will run the Google Chrome program. When you open another instance
of Chrome, you are essentially creating a two process.
In our previous example, the SUM of 2 integers, the process there is the adding of X and Y.
5. PROGRAM FLOWCHART
What is Algorithm?
Algorithm a process or set of rules to be followed in calculations or other
problem-solving operations, especially by a computer.
4
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Tip:
You can use many other symbols in a flow chart but remember that these diagrams are used
for communication . If you use symbols that only a few people understand, you may fail to get
your message across. So, be sure to keep things simple !
Define a process.
Standardize a process.
Communicate a process.
Identify bottlenecks or waste in a process.
Solve a problem .
Improve a process.
EXAMPLE #1: Create a flowchart that shows the product of 3 integers. Use the
appropriate flowchart symbols.
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input. Let say variable A, B, C representing the 3 integers.
3. Determine your Process
Getting the product of A,B,C. Write the correct expression for the Process like
PRODUCT = A * B * C
4. Determine your Output
print PRODUCT
5. To END the flowchart, use terminal button again.
Algorithm:
1. read A,B,C
2. Find the value of PRODUCT using the formula PRODUCT = A*B*C
3. Print PRODUCT
5
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Flowchart
START
input A,B,C
PRODUCT =A*B*C
print PRODUCT
END
Example #2: Calculate Pay using the formula pay = hours * rate.
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input. Base from the given formula the inputs are variable hours and
rate.
3. Determine your Process. Use the given formula.
pay = hours * rate
4. Determine your Output
print pay
5. To END the flowchart, use terminal button again.
Algorithm
1. read hours,rate
2. Find the value pay using the formula pay = hours * rate
3. Print pay
6
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Flowchart
Note: In C# programming, if you use small letters or capital letters for your variable name, use it
as it is until the program is finish likewise when you are creating a flowchart. Thus, always check
your variable names used in your flowchart.
7
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
5.6 Example #3 and #4: Flowchart example with Conditions (if statement) using
DECISION Symbol
Example #3: Determine if the body temperature is above 32 degrees print “below
freezing” otherwise print “above freezing”.
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name temperature (because it is what the problem is referring to determine
if it is above 32 degrees.)
3. Determine your condition using DECISION Symbol.
temperature < 32 (we use greater than symbol (<) to determine what message will
be displayed based from the given problem)
4. Determine your Output.
If the condition is true then
print “above freezing”
If the condition is false then
Print “below freezing”
5. To END the flowchart, use terminal button again.
Algorithm:
1. read temperature
2. Is temperature < 32 (DECISION)
3. If YES print “above freezing”
If NO print “below freezing”
8
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is age
because it is what the problem is referring to determine if a person is eligible to
vote or not
3. Determine your condition base from the problem
age >= 18
4. Determine your Output
If the condition is true then
print “Eligible to Vote”
9
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is n
because it is what the problem is referring to determine if it is positive or
negative. Variable n is just a representation u can use any valid variable name.
3. Determine your condition base from the problem
Condition 1: n > 0 (this conditions is to determine positive numbers)
Condition 2: n< 0 (this condition is to determine negative numbers)
Tip: You have to think on your Cartesian plane considering your X and Y axis
10
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Example #6: Using Nested if statements, the following flowchart determine the following:
Condition Remarks
Score < 50 Fail
Score < 60 E
Score < 70 D
Score < 80 C
Score < 90 B
Otherwise A
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is score
because it is what the problem is referring to determine the appropriate remarks
to display.
12
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Flowchart
START
read score
Score <60 T
print “E”
Score <70 T
print “D”
T
Score <80 print “C”
Score <90 T
print “B”
print “A”
END
13
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Solution:
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is i
Tip: You can use any valid variable name to represent a number or given
3. Determine your condition base from the problem
Condition is: i <= 6
Let say the value of i is 2, since, i is less than 6 it will process the
expression
i + 1 then it will proceed to i = i +2. The algorithm will repeat the process
until the result of the condition is false, then that’s the time that the
process will terminate or stop.
Algorithm
1. initialize i to 2
2. Is i < = 6
If TRUE print i + 1
i=i+2
repeat condition
If FALSE terminate
Flowchart
14
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
Steps:
1. Use the terminal button to START the flowchart
2. Determine your Input.
Variable name is n
Tip: You can use any valid variable name to represent a number or given
3. Determine your condition base from the problem
Condition is: n <= 5
Let say the value of n is 1, since, i is less than 5 it will proceed the
expression n = n + 1 then print the value of n. The algorithm will repeat
the process until the result of the condition is false, then that’s the time
the process will terminate or stop.
START
1. Initialize n to 1
2. Is n < = 5
3. If TRUE execute n = n +1 n=1
Print n
If FALSE terminate
F n<=5
T
END
n=n+1 15
print n
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
16