1. Assign an int max to be the value of the first number.
2. Compare max to the next number
3. If max is smaller than the number, let max equal the value of the number
4. Repeat step 2 and 3 until every number has been checked
5. print max value
6. terminate
The program will end once every number has been checked. It is finite.
The program will work for any set of numbers because it continues until all numbers have been checked.
No comments:
Post a Comment