program fantscrin;
const n = 15;
var a: array [1..n] of integer;
i,max,max_i:integer;
Begin
for i:=1 to n do
a[i]:= random(21)-10;
write(a[i], ' ');
max:=a[1];
max_i:=1;
for i:=2 to n do
if (a[i]>max) then
begin
max:=a[i];
max_i:=i;
end;
writeln('');
writeln('Элемент: ', max);
writeln('Индекс: ', max_i);
End.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program fantscrin;
const n = 15;
var a: array [1..n] of integer;
i,max,max_i:integer;
Begin
for i:=1 to n do
a[i]:= random(21)-10;
for i:=1 to n do
write(a[i], ' ');
max:=a[1];
max_i:=1;
for i:=2 to n do
if (a[i]>max) then
begin
max:=a[i];
max_i:=i;
end;
writeln('');
writeln('Элемент: ', max);
writeln('Индекс: ', max_i);
End.