Вы находитесь на странице: 1из 8

# Problem Solving

Recap
An algorithm is a formal sequence of instructions that defines the
solution to a problem.
An algorithm is like a recipe (instructions to prepare a meal).
Defining a Problem
Questions to ask yourself when baking Questions to ask oneself when solving
a problem
a cake
What do I need in order to bake this What is my input? This is always
What result that am I expecting to What is the output- This is end result
get? This is the output How do I get to the expected output-
What steps do I need to perform in This is the process
order to bake this cake?- This is
Lets create a defining diagram
Now that you know how to identify a problem lets learn how to
create a defining diagram.
A defining diagram allows us to define a problem. It also called an IPO
chart.
Creating a defining diagram
Remember to break up your problem into its components.
Write an algorithm that accepts two numbers and finds and prints the
sum of the two numbers

O is for out put

## 1. Draw a defining diagram

What
is P
I P 0
for?
Add the input, processes and output to the table

I P 0
Two numbers 1. Prompt the user to Sum of two numbers
enter numbers
2. Accept the two numbers
4. Print the sum of two
numbers
Good Job!!

Now that you know how create a defining diagram go ahead and
create defining diagrams for the problem statements below:
1. Write an algorithm that accepts two numbers. Your algorithm
should divide the first number by the second number. Print the