cm6 Flowchart Integrated7jan10
cm6 Flowchart Integrated7jan10
cm6 Flowchart Integrated7jan10
Tejas and Jyoti discuss a flowchart that they saw with Moz. Kaumudi: For the scenario consider the
dialogue given below of Tejas and Jyoti.
The multiplication table flowchart + scenario here.
Tejas: We visited a computer exhibition for school students. We saw a super computer,
demonstration of many uses of computer and many interesting applications.
Jyoti: In one of the stalls, we could enter any number as input and the computer was displaying the
multiplication table of the number. The picture shown above was used by the person at the stall, to
explain the sequence of steps followed by the computer, to display the table.
Jyoti: We observed that those who did not know about computers and programming could also
understand what was explained by the picture.
Moz: This picture is called a flowchart. One of the uses of flowchart is to describe the sequence of
steps and logic of solving a problem, before writing a computer program. Flowchart also helps in
communicating the steps of the solution to others.
Tejas: I see that various geometrical shapes are used in this representation. We are eager to learn
about flowcharts.
Moz: Let us start with a simple example. Look at the following flowchart of adding two natural
numbers A and B. Let us discuss the problem solution and the geometrical shapes used.
Example:
Start
Start
|
Read A A = 845
|
B = 247
|
Sum = 845 + 247
Read B |
Sum = 1092
|
Sum = A + B End
Print Sum
End
Jyoti: Start and also end of the flowchart are shown with an ellipse.
Moz: A flowchart should give a clear indication as to where the problem solving flow starts and
where it ends. The start of a problem solving process and the end are indicated using the ellipse.
Tejas: Our goal is addition of two given numbers. So, first we identify the data that is given. In
this problem we have the two numbers A and B. Reading their values are represented by
parallelograms.
Moz: Right. What would you call reading in values in computer terms?
Jyoti: Input.
Moz: The data or information that is available, (which is called input) is represented using a
parallelogram in the flowchart.
Moz: Correct.
Jyoti: The next step is to write the result of the addition, which is output in computer terms. This is
also specified in a parallelogram.
Moz: Right. A parallelogram is used to specify both input and output in a flowchart. What
else do you notice in the flowchart?
Tejas: An arrow points from one step to the next step in the flowchart.
Moz: In a flowchart arrows are used to connect the steps in a sequence and show the flow of the
problem solving process.
Jyoti: We learnt step by step thinking to solve a problem in CM III. Using flowcharts we can show
the sequence of these steps.
Moz: Yes. The step by step method of solving the problem is specified using a flowchart. This helps
you to be clear about the input, procedure and output. It also helps you to communicate the solution.
Concept
Elements of a flowchart
Various geometrical shaped boxes represent the steps of the solution.
The boxes are connected by directional arrows to show the flow of the solution.
Uses of flowchart:
To specify the method of solving a problem,
To plan the sequence of a computer program,
Communicate ideas, solutions.
Moz: Now consider the following problem and draw the flowchart for its solution.
Savani bought a toy for Rs. 325 and sold the same for Rs. 458. Explain how we can find if
Savani has made a profit or a loss.
Tejas: In this problem the goal is to find whether Savani makes a profit or loss.
Tejas: Next we have to compare Selling Price and Cost Price to find which price is more. This will
tell us whether Savani has made profit or loss. How do we show comparison in a flowchart?
Moz: Can you phrase this step as a question with the two possible answers?
Tejas: We can ask a question “ Is selling price more than cost price?”.
Moz: Right. The answer to this question can be “Yes” or “No”. If, answer is “Yes” we have to
calculate profit. If, answer is “no” we have to calculate loss. This decision taking step is
represented as follows in a flowchart.
Yes
Question? Next Step to be
taken when the
answer is yes.
No
Next Step to be
taken when the
answer is no
Jyoti: If the answer is “Yes”, it means that selling price is more than the cost price and Savani has
made profit. Profit is calculated as,
Selling price – cost price
Yes
Is SP > CP Profit = SP-CP
No
Tejas: If the answer is “No”, it means that cost price is less than selling price and Savani has made
loss. Loss is calculated as
Cost price – Selling price.
Yes
Is SP > CP Profit = SP-CP
No
Print Profit
Loss = CP - SP
Moz: Good. You have used logical reasoning to solve this problem. Now complete the flowchart.
Flowchart - How to find profit or loss
Start
Yes 2. Condition
Is SP > CP Profit = SP-CP SP is greater than CP
3. Processing
No Profit = 458 – 325
= 133
Print Profit
Loss = CP - SP 4. Output
Savani made profit of
Rs. 133.
Print Loss
Stop
Moz: Suppose you have to write a scratch program using the flowchart that you have just drawn.
Can you do it now?
Tejas: Yes. We can!
Jyoti: This is great. We can also plan a computer program using flowcharts.
Jyoti: Sometimes we need to repeat a sequence. How do we represent this in the flowchart?
Moz: Let us consider the multiplication table flowchart that you saw at the exhibition. See how
repetition is represented in a flowchart. This is also called a loop.
Multiplication table of 12 upto 10
Flowchart of multiplication table for a given number N
Start
Start Read
N = 12 Output
No Is Yes
Add 1 to the current Stop
Count = 10
value of count
Jyoti: The repetition sequence starts with Count =1. N is mltiplied with 1 and output is printed. Next
since count is not equal to 10 we add 1 to count. N is multiplied with 2 and output is printed. The
sequence is repeated next for 3, 4 and so on.
Tejas: The repetition sequence stops when Count =10.
Moz: Correct. A decision structure has been used to start and stop the repetition.
Jyoti: In this flowchart output is not coming at the end and there are multiple outputs.
Moz: Good observation. The output need not always come at the end of a flowchart. Similarly in
some flowcharts input need not always be at the beginning of the flowchart.
Moz: Try out another problem How do you find the factorial of a number?
Jyoti: Suppose the number is 10. Then factorial of ten is calculated as
10! = 1*2*3*4*5*6*7*8*9*10
Moz: Can you draw the flowchart for finding factorial of any given number?
Jyoti: Yes. We can. We have to use both decision and loop in this flowchart.
Start
Find factorial of N
Read N
Start
N = 10
M=1
Set M= 1
F=1
Set F = 1
F = 1 * 1 = 1; M < 10 ; M = 1 +1 = 2
F = 1 * 2 = 2; M < 10; M = 2 +1 = 3
F = 2 * 3 = 6; M<10; M = 3 + 1 = 4
F = 6 * 4 = 24; M<10; M = 4 +1 = 5
Add 1 to the
Current value of M ............
Print F
End
Moz: Explain the logic that is used in the loop and specifically the following processing box of the
flowchart. New value of F = current value of
F multiplied by M
Moz: Good. Now let us consider a game. Do you know the game of snakes and ladders?
Tejas: Yes.
Moz: Ok. Draw a flowchart to show how the game is played.
Tejas and Jyoti draw this flowchart.
Flowchart - Snakes and Ladder game
Start
Give dice to
Next player
Throw the dice
No
yes
Landed at the
Bottom of the ladder? Move up the ladder
No
Yes A picture of
Snakes and
ladders here next
You are the to the flowchart.
Winner
End
Uses of flowchart: Graphical representation of instructions – ex: games, building models etc.
Tejas: The flowchart itself can be put into the box of the game so that those who want to play know
the rules of the game and can easily understand how they win.
Moz: We have seen some examples where flowcharts are used. There are many more uses of
flowcharts and they can be used whenever you feel that you can communicate better with this
graphical representation.
Communicating ideas
Show the logic of classification of data
To teach and also to learn.
2. Match the elements of a flowchart and their purpose of use in the following:
Purpose Use
Calculate total of A, B, C Loop
Indicate that the problem has been solved. Start
Find if a number is greater than the other Process
Read a number and calculate the factorial of the Input
number.
Read three numbers Stop
Print the total Decision
Indicate beginning of a problem solving flow. Output
3. Complete the crossword puzzle.
4. The
a)
Indicat
e each
elemen
t of the
flowch
art by
putting
'I' for
input,
'O' for
output,
'D' for
decisio
n in the
circles
provide
d next
to the
boxes.
b) Put a
rectang
le
around
the
decisio
n
structur
e.
Hint:
See
page ....
in the
lesson.
c)
What is
the
conditi
on
which
classifi
es an
animal
as
carnivo
re.
______
______
______
______
______
______
_
Write
the
Executi
on
steps if
the
input is
a Lion.
______
______
______
___
______
______
______
____
______
______
______
______
______
______
______
______
__
______
______
______
______
____
d)
What is
the
conditi
on
which
classifi
es an
animal
as
herbivo
re?
______
______
______
______
______
______
_
Write
the
Executi
on
steps if
the
input is
an
elephan
t.
______
______
______
___
______
______
______
____
______
______
______
______
______
______
______
______
__
______
______
______
______
____
5. A, B, C are the marks scored by a student in Science, Mathematics and English. Refer the
flowchart and answer the quesions.
a) Sweta, who scores 60 marks in
Science, 70 marks in mathematics and 75 marks
in English.Use the adjacent flowchart and
provide the execution steps in calculating the
average marks of Sweta. The first step is given.
60, 70, 75
________
_________
___________
6. The following flowchart gives the steps followed while taking attendance in a class. Three arrows and a loop
are missing. Complete the flowchart as follows:
a) Draw the three missing arrows and loop at the correct place.
b) Label the decision arrows with yes or no.
Start
`
Mark present in
The register.
Is it the
Last name?
Stop
7. The following empty flowchart gives the steps to be followed while seeking admission to new
school. The phrases to be filled in the boxes are also given. Complete the flowchart by using the
phrases.
8.Lengths of three sides of a triangle a, b, c are given as input. Draw a flowchart to find if the
triangle is isosceles, equilateral, or scalene.
9. There are four types of fruits Apples, Oranges, Bananas and Grapes. Each student can pick up
two fruits. There are some conditions which have to be used to pick up the fruits. Draw a flow chart
which can take the name of first fruit as an input and print the names of second fruit or fruits that
can be picked up. The conditions are:
11. Frame a question( Hint: Try to make a question, which will have the answer given below)
For example:
The answer given is:
Some of the boxes of different shapes used in a flowchart are
, , and
b. The answer given is : In a repetition structure, the process is repeated till the condition is
satisfied.
The question can be: ___________________________________________________?
c. The answer given is : The decision structure has two branches, Yes or No.
The question can be: ___________________________________________________?
3. Activity
1.Select one of the games given below from GCompris and draw a flowchart to explain the rules of
the game. .
Memory games with images
Image name (drag and drop each item above its name)
Numbers with dice
2.Use one of the following applications - open office draw/ Kivio (available for Linux)/ Diagram
Ring (available for windows) --- to draw a flow chart for the above on the computer.
Group Activity.
Play Computer Class: Divide the class into four teams - INPUT DATA, OPERATIONS,
DECISION, and OUTPUT. Nominate one person from input and output team to play the role of
start and end box respectively. Each group has a set task to perform based on instructions given to
them by another team. You can give one the following situations for students to work through the
process of flow chart.
(i) A wired telephone in your house rings and you have to attend the call.
(ii) You visit a pediatrician for check up.
(iii) You go to a post office with a note of Rupees 10 to purchase stamps
worth Rupees 5.
Project
a) Input, output and decision phrases are given in the table given below. Note that one input phrase
corresponds to one flowchart. Draw three flow charts using the phrases in the table for the
following:
b) There are three more rules of SMART which are Safety, Reliability, and Tell. Draw a flowchart
for each of these rules by creating the phrases on your own. Compare your flowcharts with other
groups in the class.
c) The teacher can evaluate and select the flowcharts that can be converted to posters for SMART
and AWARE and put them up for display.