Your friend just bought a car. You look at the car in amazement.
"This made it around the block?"
You politely compliment the car then ask, "What kind of gas mileage does it get?"
Your friend replies, "I have no idea, how can I figure that out?"
Before you continue with this lesson, try to write down step-by-step instructions for your friend to follow to calculate the miles per gallon for the car. This is an algorithm for calculating MPG.
Test your algorithm by walking through all of the steps on paper. Write down some sample numbers and do all of the calculations.
Now look at the algorithm.Like us on Facebook: