Documente Academic
Documente Profesional
Documente Cultură
Please try these at home and be ready next Tuesday. I will randomly pick people and ask them to do
these on the board.
2. Write an algorithm for a guessing game where the user has to guess a secret number. After
every guess the program tells the user whether his number was too large or too small. At the
end, the number of tries needed to guess the number should be printed.
3. Write an algorithm to find the arithmetic average of a long list of positive numbers. The final
number in the list is a zero and this number is not repeated anywhere else in the list.
5. You are given 1000 integers. Write an algorithm to find the maximum of those 1000 numbers,
and how many times this maximum number is repeated in the set of 1000 integers (that is, for
an example, if the maximum is 10, how many 10's are there among the 1000 integers).