Вот: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 const n=5; var a: array[1..n,1..n] of integer; i,j,s: integer; begin s: =0; randomize; for i: =1 to n do begin for j: =1 to n do begin a[i,j]: =random(10); write(a[i,j]: 4); if (i+j) mod 3=0 then s: =s+a[i,j]; end; writeln; end; writeln('s=',s); end.
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.
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.