Pagini recente » Cod sursa (job #1379208) | Diferente pentru problema/twosets intre reviziile 2 si 3 | Cod sursa (job #2439328) | Cod sursa (job #1617756) | Cod sursa (job #317505)
Cod sursa(job #317505)
program euclid;
var a,b,n,c:longint;
begin
assign(input,'euclid2.in');
assign(output,'euclid2.out');
reset(input);
rewrite(output);
readln(input,n);
while n<>0 do begin
readln(input,a,b);
while ((a mod b<>0)and(b mod a<>0)) do if a>b then a:=a div b else b:= b div a;
if a>=b then writeln(output,b) else writeln(output,a);
n:=n-1;
end;
close(input);
close(output);
end.