用Pascal定义最大值

时间:2016-04-24 17:18:39

标签: pascal

我还有另外一个问题,因为这段代码在编译器中不起作用...对于很多问题我很抱歉,我认为还会有其他问题:

program findMaximum(input,output);

var
    number, Maximum: integer; 
begin
    writeln('Insert a number and finish up with 0').
    while number < >0 do
    begin
        if number> Maximum then
            Maximum := number;
        readln(number)
    end;
    if Maximum <> 0 then 
        writeln('The biggest number is',Maximum)
    else
        writeln('The input was zero.')
end.

1 个答案:

答案 0 :(得分:-3)

var
number, Maximum: integer; 
begin
maximum:=0;
writeln('Insert a number and finish up with 0');
while number < >0 do
begin
readln(number);

if number> Maximum then Maximum := number;
end;

if Maximum <> 0 then 
    writeln('The biggest number is',Maximum)
else
    writeln('The input was zero.')
end.