4)
var
a, b: integer;
function max(a, b: integer): integer;
begin
if a > b then max := a else max := b;
end;
begin
readln(a, b);
writeln(max(a, 2 * b) * max(2 * a - b, b));
end.
5)
const
n = 10;
var
a: array[1..n] of integer;
i, s: integer;
begin
for i := 1 to n do
begin
readln(a[i]);
if i mod 2 = 0 then s := s + a[i];
end;
writeln(s);
end.
6)
const
handsfree = false;
var
a: array[1..100, 1..100] of real;
product: real;
i, j, m, n: integer;
begin
{ввод матрицы}
if handsfree then begin
n := random(20) + 2;
m := random(20) + 2;
end
else begin
write('n, m =');
readln(n, m);
end;
writeln('Данные матрицы:');
for i := 1 to m do
begin
for j := 1 to n do
if handsfree then begin
a[i, j] := random(100) - 50;
write(a[i, j]:4, ' ')
end
else
read(a[i, j]);
writeln;
end;
product := 1;
for i := 1 to m do
for j := 1 to n do
if a[i, j] > 0 then
product := product * a[i, j];
writeln('product = ', product);
end.