program uocchunglonnhat; uses crt; var a,b,UCLN,n,m: integer; begin clrscr; write(‘ nhap a=’); readln(a); write(‘nhap b=’); readln(b); m:=a; n:=b; while m<>n do begin if m>n then m:= m-n else n:= n-m; end; writeln(‘ uoc chung lon nhat cua ‘,a,’ va ‘,b,’ laf: ‘,n); readln end. Bình luận
var a, b: integer; begin write(‘ nhap a = ‘); readln(a); write(‘nhap b = ‘); readln(b); while a<>b do if a>b then a:=a-b else b:=b-a; writeln(‘UCLN: ‘, a); readln end. Bình luận
program uocchunglonnhat;
uses crt;
var a,b,UCLN,n,m: integer;
begin
clrscr;
write(‘ nhap a=’); readln(a);
write(‘nhap b=’); readln(b);
m:=a;
n:=b;
while m<>n do begin
if m>n then
m:= m-n
else n:= n-m;
end;
writeln(‘ uoc chung lon nhat cua ‘,a,’ va ‘,b,’ laf: ‘,n);
readln
end.
var a, b: integer;
begin
write(‘ nhap a = ‘); readln(a);
write(‘nhap b = ‘); readln(b);
while a<>b do
if a>b then a:=a-b
else b:=b-a;
writeln(‘UCLN: ‘, a);
readln
end.