Page 77 - Digital_Kids_5
P. 77
7. Close the bag.
Example 2-Algorithm for Making a Cup of Tea
1. Get a cup, a teabag, and a kettle.
2. Fill the kettle with water.
3. Put the teabag in the cup.
4. Boil the water in the kettle.
5. Pour the boiling water into the cup.
6. Let the tea steep for a few minutes.
7. Add milk or sugar, if desired.
8. Stir the tea.
9. The tea is ready.
Algorithms in Computer Science
Algorithms are the foundation of all computer software. They dictate how a program
processes data, makes decisions, and performs tasks. A well-designed algorithm is crucial
for a program's efficiency and performance, determining how quickly it can solve a problem
and how much memory it uses. Without algorithms, computers would simply be unable
to perform any of the complex tasks we rely on daily, from running a search engine to
powering a navigation app.
Algorithm to Calculate Sum and Average
This algorithm takes three numbers as input, performs a set of calculations, and then
provides the output.
1. Start: Begin the process.
2. Input first Number (A): Get the first number and store it as a variable named 'A'.
3. Input second Number (8): Get the second number and store it as 'B'.
4. Input third Number : Get the third number and store it as 'C'.
5. Find the sum of three numbers: Calculate the sum using the formula (A+B+C).
6. Find the average: Divide the sum from the previous step by 3 using the formula (A +
B + C)/3.
7. Print Average: Display the calculated average.
8. Stop: The algorithm is complete.
77 Computer — 5

