a)
Var a: Array [1..30] of Integer;
i, Count: Byte;
Sum: Real;
BEGIN
for i:= 1 to 30 do Read(a[i]);
WriteLn;
Sum := 0;
Count := 0;
for i:= 1 to 30 do
if (a[i] mod 5) = 0 then
BEGIN
Sum := Sum + a[i];
Count := Count + 1;
END;
Writeln(Sum / Count);
Readln;
END.
b)
Var a: Array [1..200] of Integer;
i: Byte;
Max, Min: Integer;
BEGIN
for i:= 1 to 200 do Read(a[i]);
WriteLn;
Max := a[1];
Min := a[1];
for i:= 2 to 200 do
BEGIN
if a[i] > Max then Max = a[i];
if a[i] < Min then Min = a[i];
END;
Writeln(Max, ' ', Min);
Readln;
END.
Bạn tham khảo code Pascal ở trên nhé.