CSC1100
Computer programming
1
lab1
week2
Recalling information on first lecture
Computational Thinking
Put the number of correct definition in the box next to the keyword.
Decomposition 1. Identifying similarities encountered within similar
problems.
Pattern
2. Step by step instructions on how to complete a task.
Recognition
3. Breaking down the problem into smaller, more
Abstraction manageable chunks.
4. Focusing on the important information, filtering out
Algorithm unnecessary information.
Debugging 5. Finding and fixing issues in code.
Decision 6. Has one input, and two outputs: yes or no / true or false.
Let's Have fun
What is flow chart
• A flowchart is a graphical representation of a process.
• It’s a diagram that illustrates the workflow required to
complete a task or a set of tasks with the help of symbols,
lines and shapes.
ANSI/ISO Shape Name Description
Shows the process's order of operation. A line
Flowline coming from one symbol and pointing at
another.
Indicates the beginning and ending of a
program or sub-process. They usually contain
Terminal / the word "Start" or "End", or another phrase
Terminator signaling the start or end of a process, such
as "submit inquiry" or "receive product".
Represents a set of operations that changes
Process value, form, or location of data. Represented
as a rectangle.
Shows a conditional operation that determines
which one of the two paths the program will
Decision take. The operation is commonly a yes/no
question or true/false test. Represented as a
diamond
Input/Output Indicates the process of inputting and outputting
data, as in entering data or displaying results
Preparation or Represented by an elongated hexagon, originally
Initialization used for steps like setting a switch or initializing
a routine.
How to plan and draw a basic flowchart
1. Define your purpose and scope. What do you hope to accomplish? Are you studying the right things with
appropriate start and end points to accomplish that purpose? Be detailed enough in your research but
simple enough in your charting to communicate with your intended audience.
2. Identify the tasks in chronological order. This might involve talking to participants, observing a process
and/or reviewing any existing documentation. You might write out the steps in note form, or begin a
rough chart.
3. Organize them by type and corresponding shape, such as process, decision, data, inputs or outputs.
4. Draw your chart, either sketching by hand or using a program such as Lucidchart / [Link].
5. Confirm your flowchart, walking through the steps with people who participate in the process. Observe
the process to make sure you haven’t missed anything important to your purpose.
Draw a flowchart to read the two sides of a
rectangle and calculate its area.
Step1: start
Step2: read width and length of rectangle
Step3: calculate area
Step4:print area
Step5: end
sequence
Draw a flowchart to read a number and identify
either the number is positive or negative.
Step1: start
Step2: Declare a variable N
Step3: if N < 0 then print("Negative number")
Step5: else print("Positive number")
Step6: end
selection
Draw a flowchart to read two values,
determines the largest value and prints the
largest value with an identifying message.
a) Declare two variables
b) Check if VALUE1 is larger than VALUE2
c) if VALUE1 > VALUE2 then
print("The largest value is " + VALUE1)
d) else VALUE1 is smaller than VALUE2
print("The largest value is " + VALUE2)
e) End if
Print
“The largest value is ” +
MAX
Draw a flowchart to add even numbers
from 0 to 20
iteration
Count
%2==0
Thank you