a,b,z,LCM:integer;
i:boolean;
z:=1;
i:=false;
if a<=b then
begin
While (i = false) and (z<b)do
begin
if (b mod (a*z) = 0) then
i:=true;
LCM:=a*z
else
z:=z+1;
end;
if z=b then
LCM:=a*b;
if LCM<b then
LCM:=b;
end
else
begin
While (i = false) and (z<a)do
begin
if (a mod (b*z) = 0) then
i:=true;
LCM:=b*z
else
z:=z+1;
end;
if z=a then
LCM:=a*b;
if LCM<a then
LCM:=a;
end;
var a,b,i,LCM:integer;
begin
readln(a,b);
for i:=1 to a*b do
if (i mod a = 0)and(i mod b = 0)
then begin
LCM:=i;
i:=a*b;
end;
end.
var a,b,i,LCM:integer;
begin
readln(a,b);
for i:=1 to b do
if (a*i mod b = 0)
then begin
LCM:=a*i;
i:=b;
end;
end.
歡迎光臨 香港寵物小精靈村落 論壇 (https://proxy.archiver.hkpnve.pokebeacon.com/) | Powered by Discuz! X3.2 |