Ответ:
{Free Pascal Compiler version 3.0.4+dfsg-23 [2019/11/25] for x86_64}
{Copyright (c) 1993-2017 by Florian Klaempfl and others}
{Target OS: Linux for x86-64}
program test;
Uses Math;
const N = 15;
var
A : array[1..N] of integer;
i, mx, k : integer;
begin
Randomize;
{Генерация и печать массива}
for i := 1 to N do begin
A[i] := Random(50);
write(A[i], ' ');
if A[i] mod 2 = 1 then mx := A[i]
end;
writeln;
for i := 1 to N do
if A[i] mod 2 = 1 then
if A[i] < mx then begin
mx := A[i];
k := i
writeln('Число - ', mx, ', позиция - ', k);
end.
Результат выполнения программы:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
{Free Pascal Compiler version 3.0.4+dfsg-23 [2019/11/25] for x86_64}
{Copyright (c) 1993-2017 by Florian Klaempfl and others}
{Target OS: Linux for x86-64}
program test;
Uses Math;
const N = 15;
var
A : array[1..N] of integer;
i, mx, k : integer;
begin
Randomize;
{Генерация и печать массива}
for i := 1 to N do begin
A[i] := Random(50);
write(A[i], ' ');
if A[i] mod 2 = 1 then mx := A[i]
end;
writeln;
for i := 1 to N do
if A[i] mod 2 = 1 then
if A[i] < mx then begin
mx := A[i];
k := i
end;
writeln('Число - ', mx, ', позиция - ', k);
end.
Результат выполнения программы: