1. var a:array [1..4, 1..4] of integer; i, j, max: integer; Begin for i := 1 to 4 do begin for j := 1 to 4 do read(a[i][j]); readln; end; max := a[1][1]; for i := 2 to 4 do if max < a[i][i] then max := a[i][i]; writeln(max); End.
2. var a:array [1..5, 1..5] of integer; i, j, m, sum: integer; Begin for i := 1 to 5 do begin for j := 1 to 5 do read(a[i][j]); readln; end; readln(m); sum := 0; for i := 1 to 5 do if (m - i > 0) and (m - i < 6) then sum := sum + a[i][m - i]; writeln(sum); End.
3. Const N = 5; var a:array [1..N, 1..N] of integer; i, j, max: integer; Begin for i := 1 to N do begin for j := 1 to N do read(a[i][j]); readln; end; max := a[1][N]; for i := 2 to N do if (max < a[i][N + 1 - i]) then max := a[i][N + 1 - i]; writeln(max); End.
4. Const N = 5; var a:array [1..N, 1..N] of integer; i, j, count: integer; sum: real; Begin for i := 1 to N do begin for j := 1 to N do read(a[i][j]); readln; end; sum := 0; count := 0; for i := 1 to N do if (a[5][i] mod 2 = 1) then begin sum := sum + a[5][i]; inc(count); end; sum := sum / count; writeln(sum); End.
5. var a:array [1..4, 1..4] of integer; i, j, upper_sum, lower_sum: integer; Begin for i := 1 to 4 do begin for j := 1 to 4 do read(a[i][j]); readln; end; upper_sum := 0; lower_sum := 0; for i := 1 to 4 do begin for j := i + 1 to 4 do upper_sum := upper_sum + a[i][j]; for j := 1 to i - 1 do lower_sum := lower_sum + a[i][j]; end; writeln(upper_sum); writeln(lower_sum); End.
var a:array [1..4, 1..4] of integer; i, j, max: integer;
Begin
for i := 1 to 4 do
begin
for j := 1 to 4 do
read(a[i][j]);
readln;
end;
max := a[1][1];
for i := 2 to 4 do
if max < a[i][i] then max := a[i][i];
writeln(max);
End.
2.
var a:array [1..5, 1..5] of integer; i, j, m, sum: integer;
Begin
for i := 1 to 5 do
begin
for j := 1 to 5 do
read(a[i][j]);
readln;
end;
readln(m);
sum := 0;
for i := 1 to 5 do
if (m - i > 0) and (m - i < 6) then
sum := sum + a[i][m - i];
writeln(sum);
End.
3.
Const N = 5;
var a:array [1..N, 1..N] of integer; i, j, max: integer;
Begin
for i := 1 to N do
begin
for j := 1 to N do
read(a[i][j]);
readln;
end;
max := a[1][N];
for i := 2 to N do
if (max < a[i][N + 1 - i]) then
max := a[i][N + 1 - i];
writeln(max);
End.
4.
Const N = 5;
var a:array [1..N, 1..N] of integer; i, j, count: integer; sum: real;
Begin
for i := 1 to N do
begin
for j := 1 to N do
read(a[i][j]);
readln;
end;
sum := 0;
count := 0;
for i := 1 to N do
if (a[5][i] mod 2 = 1) then
begin
sum := sum + a[5][i];
inc(count);
end;
sum := sum / count;
writeln(sum);
End.
5.
var a:array [1..4, 1..4] of integer; i, j, upper_sum, lower_sum: integer;
Begin
for i := 1 to 4 do
begin
for j := 1 to 4 do
read(a[i][j]);
readln;
end;
upper_sum := 0;
lower_sum := 0;
for i := 1 to 4 do
begin
for j := i + 1 to 4 do
upper_sum := upper_sum + a[i][j];
for j := 1 to i - 1 do
lower_sum := lower_sum + a[i][j];
end;
writeln(upper_sum);
writeln(lower_sum);
End.
1)
var
a: 100..999;
a1, a2, a3: 0..9; //а1 - сотни, а2 - десятки, а3 - единицы
begin
writeln('введите натуральное трехзначное число');
readln(a);
a1: = a div 100;
a2: = (a mod 100) div 10;
a3: = a mod 10;
writeln('полученное число: ', a1, a3, a2);
end.
2)
var
a: 100..999;
a1, a2, a3: 0..9;
begin
writeln('введите натуральное трехзначное число');
readln(a);
a1: = a div 100;
a2: = (a mod 100) div 10;
a3: = a mod 10;
writeln('полученное число: ', a2, a1, a3);
end.
3)
var
a: 100..999;
a1, a2, a3: 0..9;
begin
writeln('введите натуральное трехзначное число');
readln(a);
a1: = a div 100;
a2: = (a mod 100) div 10;
a3: = a mod 10;
writeln('полученное число: ', a3, a1, a2, a3);
end.
4)
var
a: 1000..9999;
a1, a2, a3, a4: 0..9;
begin
writeln('введите натуральное четырехзначное число');
readln(a);
a1: = a div 1000; //тысячи
a2: = (a mod 1000) div 100; //сотни
a3: = (a mod 100) div 10; //десятки
a4: = a mod 10; //единицы
writeln('полученное число: ', a4, a3, a2, a1);
end.
все остальное делается наподобие этого: просто в writeln меняешь местами цифры и все.