Pagini recente » Cod sursa (job #3165225) | Cod sursa (job #1789389) | Cod sursa (job #398276) | Cod sursa (job #2367920) | Cod sursa (job #288573)
Cod sursa(job #288573)
var a,b,min,i,cmmdc,nr,j:int64;
begin
assign(input,'euclid2.in');
assign(output,'euclid2.out');
reset(input);
rewrite(output);
read(nr);
for j:=1 to nr do begin
readln(a,b);
if a<b then min:=a else min:=b;
for i:=1 to min do begin
if (a mod i=0)and(b mod i=0) then cmmdc:=i;
end;
if cmmdc=1 then write('0') else writeln(cmmdc);
end;
close(input);
close(output);
end.