program LCMCalculator;
function LCM(a, b: Longint): Longint;
var
lmc: Longint;
begin
if a > b then
lmc := a
else
lmc := b;
while true do
begin
if (lmc mod a = 0) and (lmc mod b = 0) then
begin
LCM := lmc;
exit;
end;
inc(lmc);
end;
end;
var
result, i: Longint;
begin
result := 1;
for i := 1 to 20 do
result := LCM(result, i);
writeln('LCM of numbers from 1 to 20 is: ', result);
end.
(*
run:
LCM of numbers from 1 to 20 is: 232792560
*)