Pagini recente » Cod sursa (job #2375883) | Cod sursa (job #207335) | Cod sursa (job #747878) | Borderou de evaluare (job #1425767) | Cod sursa (job #752635)
Cod sursa(job #752635)
program algortim;
var f,g:text;
t:longint;
x,y,r,i,aux:longint;
begin
assign(f,'euclid2.in');reset(f);readln(f,t);
assign(g,'euclid2.out');rewrite(g);
r:=0;
for i:=1 to t do begin
readln(f,x,y);
if x<y then begin
aux:=x;x:=y;y:=aux;
end;
repeat
r:=x mod y;x:=y;y:=r;
until r=0;
writeln(g,x);
end;
close(f);close(g);
end.