Pagini recente » in4it-UAB: concurs national de informatica pentru elevi | Cod sursa (job #598406) | Cod sursa (job #1608835) | Cod sursa (job #1753756) | Cod sursa (job #602400)
Cod sursa(job #602400)
Program euclid;
var t,a,b,i:longint;
fi,fo: text;
begin
assign(fi,'euclid2.in');
reset(fi);
assign(fo,'euclid2.out');
rewrite(fo);
readln(fi,t);
for i:=1 to t do begin
readln(fi,a,b);
repeat
if a>b then a:=a-b
else b:=b-a;
until (a=0) or (b=0);
if a=0 then writeln(fo,b)
else writeln(fo,a);
end;
close(fo);
end.