Professional Documents
Culture Documents
Introduction To Algorithms: CSBP119 - Algorithms & Problem Solving
Introduction To Algorithms: CSBP119 - Algorithms & Problem Solving
http://math.hws.edu/javanotes/c1/s1.html
Exercises
• What is a loop?
• A piece of code that runs repeatedly
• Going back “up” in the program
Exercise
• Write an algorithm that finds the maximum of 100 given numbers.
• Solution:
1. Read a number and store it in max
2. Repeat the following 99 times:
a) Read a number and store it in X
b) If X > max then max =x
3. Display max