USES crt;
VAR n,m,p,q:integer;
Function UCLN(x,y:integer):integer;
Var i,t:integer;
Begin
for i:=1 to x do
if (x mod i=0) and (y mod i =0) then t:=i;
UCLN:=t;
End;
BEGIN
clrscr;
write('Nhap n:'); readln(n);
write('Nhap m:'); readln(m);
p:=n div UCLN(n,m); q:=m div UCLN(n,m);
write('Cap (p,q) la:',p,' ',q);
readln;
END.
Đúng 0
Bình luận (0)