Pagini recente » Cod sursa (job #1182149) | Cod sursa (job #1146322) | Cod sursa (job #1247149) | Cod sursa (job #1009583) | Cod sursa (job #586481)
Cod sursa(job #586481)
Program Euclid2;
var i,t,x,y,r:longint;
f1,f2:text;
Function Euclid(a,b:longint ) : longint;
begin
while a<>b do
if a>b then a:=a-b
else b:=b-a;
Euclid:=a;
end;
begin
assign(f1,'euclid2.in'); reset(f1);
assign(f2,'euclid2.out'); rewrite(f2);
readln(f1,t);
for i:=1 to t do
begin
readln(f1,x,y);
r:=euclid(x,y);
writeln(f2,r);
end;
close(f1); close(f2);
end.