Comutational Thinking Worksheets
Comutational Thinking Worksheets
Learning Objectives
Learners will learn to:
follow, understand, edit and correct algorithms that are presented as flowcharts
these errors
understand and use selection statements, limited to IF, THEN, ELSE, presented
as flowcharts
Vocabulary
Flowchart
blueprint
sequence
selection
Let Us Start
1
Let Us Explore
Remove any three matchsticks to leave only three squares.
To get the desired result, think in a stepwise manner. You can create an algorithm to
get the desired result. It is important to be careful and precise when developing an
algorithm. A single mistake can cause errors and produce the wrong results.
Get, Set, Go
1.1 Using flowchart
A flowchart is a pictorial representation of an algorithm that provides a detailed and
organized overview of its steps. It uses symbols to represent various statements within
the algorithm. The flowchart is designed from top to bottom to depict the exact
We must follow some rules while drawing a flowchart from an algorithm. The rules
include:
1. Identify the input and output of the algorithm. This step is essential as it helps
us understand what data is being fed into the algorithm and what results are
expected.
2. Identify the steps of the process. This step requires careful analysis of the
output.
2
1.2 Flowchart symbol
Flowchart symbols are geometrical shapes used to represent different elements of an
algorithm. These symbols are interconnected by arrow lines to illustrate the flow of the
sequence. Using geometric shapes in the flowchart ensures that the sequence of
algorithms.
Tech Tickler
A variable is the name of the data input to the system. It keeps on changing
its value during the execution of the program. Its value can be incremented
and decremented as per the requirement.
3
Example 1
An algorithm and flowchart to find the sum of two numbers.
Algorithm
Step 1: Start
Step 3: Find the sum of num1 and num2 and store it in Sum
Step 5: Stop
Flowchart
Start
Sum=num1+num2
Display Sum
End
Output
If the user enters num1 = 9 and num2 = 10, the sum of the two numbers will
be 19.
If the user enters num1= a and num2 = b, the algorithm will not work. Instead,
it will give an error as letters are supplied instead of numbers for variables
changes to find the sum of the three numbers. Then, create a flowchart for the
algorithm.
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
Flowchart
5
Check For Understanding
Draw a flowchart for the given algorithm to find the area of a circle.
Step 1: Start
Step 5: Stop
Flowchart
1. Predict the output if the following values are entered for the radius.
a. 6 - _________________________
b. 2.5 - _______________________
Assignment
1. Explore and find the options in MS Word to draw a flowchart.
2. Explore and mention the open-source software used to draw a flowchart. One
6
1.3 Using operators
Operators allow us to manipulate and combine values to produce desired results. Let
They return either true or false based on the comparison result. Here are the
If x=5, y =10
Less than (<) Checks if the left operand is less (x < y) true
right operand
operand
Logical operators
Logical operators are used to join two or more variables or conditions. These are
7
Operator Explanation Example Result
If x=5, y =10
AND Returns true if both operands are ((x>5) && (y=10)) false
false.
a selection. The program then asks questions and selects a specific path based on the
answers received.
has the key commands ‘IF’, ‘THEN’ and ‘ELSE’. The three parts of the selection
statements are:
diamond has two arrows that come from it. One arrow is followed when the condition
is True (or yes). The second is followed when the condition is False (or no).
yes/true
IS A < B?
no/false
8
Example 1
An algorithm and flowchart to find the profit or loss for a given cost price and selling
price.
Algorithm
Step 1: Start
Step 4: Check whether SP>CP. If Yes, calculate the profit as SP-CP and then
Step 5: End
Flowchart
Output
If the user enters CP = 100 and SP =150, The decision box checks if SP<CP
If the user enters CP = 200 and SP =170, The decision box checks if SP<CP
9
Example 2
An algorithm and flowchart to find if a number is both positive and even:
Algorithm
Step 1: Start
Step 3: If the number is greater than 0 AND the number modulo 2 is equal to 0, then
else
Step 4: End
Flowchart
10
Check For Understanding
Draw a flowchart for the given algorithm to check the driver's age before issuing the
driving license.
Step 1: Start.
Step 6: Stop.
Flowchart
11
• What will be the output of the flowchart if the user enters the age as 25?
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
performs its intended function correctly. You must trace the algorithm yourself before
you identify and correct the error. You must walk through the flowchart one step at a
the requirements. If these requirements are met, then it is time to test your flowchart.
Predict the output, then run the flowchart to see if it works correctly.
If it is not working out as expected, then look at the output you got and the expected
Requirements checklist
Does each input, output and process have one data flow arrow
If you have used a variable, have you used the same name
consistently?
Have you used a variety of data to check for the desired output?
12
Activity 2
Write an algorithm to find the area of a rectangle. Use the different sets of data, i.e.,
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
Unit Review
1. A flowchart is a pictorial representation of an algorithm that provides a
2. While drawing a flowchart from an algorithm, we must identify the input and
output of the algorithm, identify the steps of the process and then draw a
of an algorithm.
13
5. A selection statement is used when a decision needs to be made in an
a. Numbers
b. Words
c. Symbols
d. Lines
14
4. What is the benefit of visualizing an algorithm using a flowchart?
algorithm
5. What is an example of using test data for an algorithm that calculates the area of
a rectangle?
Project Work
Draw a flowchart for the algorithm to find the largest of the three numbers.
Step1: Start
Step 3: If a is greater than b and a is greater than c, then display "a is the largest
number" Go to step 4. Else if b is greater than a and b is greater than c, then display
"b is the largest number" Go to step 4. Else Display "c is the largest number" End if
Step 4: Stop
Flowchart
15
Lab Work
1. Perform the following tasks.
a. Write an algorithm to accept a person's age and check whether he/she is
more.
c. Create and use checklist to identify any errors in the algorithm and
flowchart.
https://www.programiz.com/article/flowchart-programming https://www.youtube.com/watch?v=XFCAjHGZgGI
16