首页 > 试题广场 >

var tmp, max, min, sum, coun

[填空题]
var
  tmp, max, min, sum, count : longint;
begin
  count := 0;
  read(tmp);
  if tmp = 0 then
    exit;
  max := tmp;
  min := tmp;
  sum := tmp;
  inc(count);
  while tmp <> 0 do
  begin
    read(tmp);
    if tmp <> 0 then
    begin
      inc(sum, tmp);
      inc(count);
      if tmp > max then
        max := tmp;
      if tmp < min then
        min := tmp;
    end;
  end;
  writeln(max, ',', min, ',', sum div count);
end.

输入: 1 2 3 4 5 6 0 7
输出:1

这道题你会答吗?花几分钟告诉大家答案吧!