Câu trả lời:
BCNN:
program boichung;
var m,n: word;
procedure Input;
begin
readln(m,n);
end;
function BC(m,n: word): word;
var i: word;
begin
for i := 1 to n * m do
if (i mod n = 0) and (i mod m = 0) then
write(i,' ');
end;
begin
Input;
BC(m,n);
end.
UCLN:
program UCLN;
var m,n,r,i: longint;
begin
readln(n,m);
n := abs(n);
m := abs(m);
if (n = 0) then
begin
i := 1;
write(m);
end
else
if (m = 0) then
begin
i := 1;
write(n);
end;
r := n mod m;
while r <> 0 do
begin
r := n mod m;
n:= m;
m:= r;
end;
if (i = 0) then
write(n);
readln
end.