Ответ:
Решение
Pascal- Python
var
a: array[1..1000] of real;
n, i, mi, ma: integer;
max, min: real;
begin
write('Введите N: ');
readln(n);
for i := 1 to n do
write('Введите ', i, ' элемент: ');
readln(a[i]);
if i = 1 then begin max := a[i]; min := a[i]; ma := i; mi := i; end;
if min > a[i] then begin min := a[i]; mi := i; end;
if max < a[i] then begin max := a[i]; ma := i; end;
end;
writeln;
writeln('Ваш массив: ');
for i := 1 to n do writeln(i, ') ', a[i], ' ');
writeln('Массив после замены Max на Min: ');
a[mi] := a[ma] + a[mi];
a[ma] := a[mi] - a[ma];
a[mi] := a[mi] - a[ma];
end.
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Решение
Pascal- Python
var
a: array[1..1000] of real;
n, i, mi, ma: integer;
max, min: real;
begin
write('Введите N: ');
readln(n);
for i := 1 to n do
begin
write('Введите ', i, ' элемент: ');
readln(a[i]);
if i = 1 then begin max := a[i]; min := a[i]; ma := i; mi := i; end;
if min > a[i] then begin min := a[i]; mi := i; end;
if max < a[i] then begin max := a[i]; ma := i; end;
end;
writeln;
writeln('Ваш массив: ');
for i := 1 to n do writeln(i, ') ', a[i], ' ');
writeln;
writeln('Массив после замены Max на Min: ');
a[mi] := a[ma] + a[mi];
a[ma] := a[mi] - a[ma];
a[mi] := a[mi] - a[ma];
for i := 1 to n do writeln(i, ') ', a[i], ' ');
end.