Write a recursive function that calculates the maximum value from a sequence of integers given not its input. The input ends with the number 0. The main program must contain a function call and a result output. Loops are not allowed
Input: The input lines contain integers, one in each line. The last line contains the number 0.
Output: The program should output a single number – the maximum value of all elements of the sequence (not counting the number 0).
Examples
# |
Input |
Output |
1 |
1
3
2
0 |
3 |
Запрещенные операторы:for;while;until