Ответ:
var
i, k, max: integer;
a: array[1..40] of integer;
begin
WriteLn('Исходный массив:');
for i := 1 to 40 do
a[i] := round(random(100));
Write(a[i], ', ');
end;
max := a[1];
k := 1;
for i := 2 to 40 do
if a[i] > max then
max := a[i];
k := i;
WriteLn();
WriteLn('Максимальный элемент a[', k, '] = ', max);
WriteLn('Результат:');
if i > 35 then a[i] := a[i] * k;
end.
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
var
i, k, max: integer;
a: array[1..40] of integer;
begin
WriteLn('Исходный массив:');
for i := 1 to 40 do
begin
a[i] := round(random(100));
Write(a[i], ', ');
end;
max := a[1];
k := 1;
for i := 2 to 40 do
if a[i] > max then
begin
max := a[i];
k := i;
end;
WriteLn();
WriteLn('Максимальный элемент a[', k, '] = ', max);
WriteLn('Результат:');
for i := 1 to 40 do
begin
if i > 35 then a[i] := a[i] * k;
Write(a[i], ', ');
end;
end.
Объяснение: