var n, i, j, minLCM, num1, num2: integer; arr: array[1..100] of integer;
function LCM(a, b: integer): integer; var x, y, t: integer; begin x := a; y := b; while y <> 0 do begin t := y; y := x mod y; x := t; end; LCM := (a * b) div x; end;
begin write('Введите количество чисел: '); readln(n);
writeln('Введите ', n, ' чисел: '); for i := 1 to n do read(arr[i]);
for i := 1 to n-1 do for j := i+1 to n do if LCM(arr[i], arr[j]) < minLCM then begin minLCM := LCM(arr[i], arr[j]); num1 := arr[i]; num2 := arr[j]; end;
writeln('Пара чисел с наименьшим НОК: ', num1, ' и ', num2); end.
program MinLCM;
var
n, i, j, minLCM, num1, num2: integer;
arr: array[1..100] of integer;
function LCM(a, b: integer): integer;
var
x, y, t: integer;
begin
x := a;
y := b;
while y <> 0 do
begin
t := y;
y := x mod y;
x := t;
end;
LCM := (a * b) div x;
end;
begin
write('Введите количество чисел: ');
readln(n);
writeln('Введите ', n, ' чисел: ');
for i := 1 to n do
read(arr[i]);
minLCM := LCM(arr[1], arr[2]);
num1 := arr[1];
num2 := arr[2];
for i := 1 to n-1 do
for j := i+1 to n do
if LCM(arr[i], arr[j]) < minLCM then
begin
minLCM := LCM(arr[i], arr[j]);
num1 := arr[i];
num2 := arr[j];
end;
writeln('Пара чисел с наименьшим НОК: ', num1, ' и ', num2);
end.