% Find the largest number given as input.

const small := -1000000
const N: int := 100		% maximum names

var i:       int  := 0
var maximum: real := small	% start max off very small

var numbers : array 1 .. N of real

put "Enter a list of numbers and I'll find the largest number"
loop
	get skip
	exit when eof or i >= N
	i := i + 1
	get numbers(i)
	if numbers(i) > maximum then
		maximum := numbers(i)
	end if
end loop

if i = 0 then
	put "Hey!  You didn't enter anything."
else
	if i >= N then
		put "We ran out of room to store all the numbers."
		put "The maximum is only based on the first ", N, " of them."
	end if
	put "The maximum is ", maximum
end if
