Page 125 - Computer - 4
P. 125
Step 1: Get the phone number of the friend you want to talk to.
Step 2: Dial the number on the phone.
Step 3: When the call is picked up, inquire who the other person is.
Step 4: If the person is your friend, talk to him and go to Step 6, else
Step 5: Ask for your friend. When he comes to the phone, talk to him.
Step 6: End the call.
In the above example, Step 3 presented two situations. Depending on the person
who picked the call, we either follow Step 4 or Step 5. Thus, we made a decision
based on the situation to follow one of the two courses of action available.
Some problems have a solution where we need to repeat certain steps to solve the
problem. Carrying out a step or group of steps more than once is called Repetition
of steps or Loop.
No Yes
Decision?
Example 4: Your school carried out a charity drive to collect funds for the elderly and
homeless people. You need to calculate the total amount collected by the students
of your class and report it to the class teacher.
Step 1: Obtain the list of students who participated in the charity drive.
Step 2: Obtain the amount collected by the student.
Step 3: Add the amount collected to the previous amount. (The initial sum is zero)
Step 4: If there are more students left in the list, repeat Steps 2 and 3, else
Step 5: Report the amount to the class teacher.
Here, Steps 2 and 3 will be repeated for every student till all students in the list are
not finished.
123