в двумерном массиве найтив двумерном массиве найти минимальные и максимальные элементы и вычислить их сумму произведение и разность (Составить программу)
Ответы
Ответ дал:
0
Program Pr;
Var
a : array [1..100, 1..100] of integer;
i, max, min, j, n: integer;
Begin
cls;
read(n);
min := 100000;
max := -100000;
for i := 1 to n do
for j := 1 to n do
begin
read(a[i,j]);
if (a[i,j] > max) then
max := a[i,j];
if (a[i,j] < min) then
min := a[i,j];
end;
writeln ('Сумма = ', min + max);
writeln ('Разность = ', max - min);
writeln ('Произведение = ', max * min);
End.
Var
a : array [1..100, 1..100] of integer;
i, max, min, j, n: integer;
Begin
cls;
read(n);
min := 100000;
max := -100000;
for i := 1 to n do
for j := 1 to n do
begin
read(a[i,j]);
if (a[i,j] > max) then
max := a[i,j];
if (a[i,j] < min) then
min := a[i,j];
end;
writeln ('Сумма = ', min + max);
writeln ('Разность = ', max - min);
writeln ('Произведение = ', max * min);
End.
Похожие вопросы
2 года назад
7 лет назад
7 лет назад
10 лет назад
10 лет назад