PF FALL 2020 - Lab 2
PF FALL 2020 - Lab 2
Programming Pre-Programming
Fundamentals phase
Learning Objectives
This lab will cover the following topics:
Writing an algorithm
• Introduction to flow chart
• Structuring a program by using flow charts
1|Page
Guidelines for Developing Flowcharts
These are some points to keep in mind while developing a flowchart −
Flowchart can have only one start and one stop symbol
On-page connectors are referenced using numbers
Off-page connectors are referenced using alphabets
General flow of processes is top to bottom or left to right
Arrows should not cross each other
Example:
Structuring a Program by using flow charts
1. Use Modules
2. Use logic structures
a. Sequential structure
- Executes instructions one after another in a sequence.
b. Decision structure
- Branches to execute one of two possible sets of instructions.
c. Loop structure
- Executes set of instruction many times.
3. Eliminate rewriting of identical process by using modules.
4. Use techniques to improve readability including four logic structure, proper
naming of variables, internal documentation and proper indentation.
b. Sequential structure:
Example: Draw a flow chart that will allow the user to input 3 integers and have the sum
calculated and outputted.
c. Decision structure
Example: Today it is raining! Draw a flow chart which ask about raining outside and take the
decision of taking an umbrella with himself for going outside.
d. Loop structure
Example: Draw a flow chart that find the sum of five numbers.
LAB TASK
Task# 01:
Write an algorithm and also draw a flowchart that performs addition of two numbers?
Task# 02:
Write an algorithm and also draw a flowchart that prints hello world 10 times?
Task# 03:
Write an algorithm and also draw a flowchart to login to Facebook account?
Task# 04:
Write an algorithm along with drawing a flowchart to find a number that whether it
is even or odd.
Task# 05
Illustrate the following statement by drawing a flow chart. “A lamp in a room is
not working, check if it is not plugged in, do plug it or check whether it might be
burned out so replace it if not then repair it.”
Task# 06
Write Algorithm & Flowchart to print multiplication Table of a number.
Task# 07
Write Algorithm & Flowchart to find if a number is prime or not.