Pagini recente » Cod sursa (job #1851403) | Cod sursa (job #1932173) | Cod sursa (job #56877) | Borderou de evaluare (job #1570986) | Cod sursa (job #291088)
Cod sursa(job #291088)
var i,a,b,n:word;
f:text; aa,bb:array[1..1000] of word;
begin
assign(f,'euclid2.in');reset(f);
readln(f,n);
for i:=1 to n do begin
read(f,aa[i]); readln(f,bb[i]); end;
close(f);
assign(f,'euclid2.out');rewrite(f);
for i:=1 to n do begin
a:=aa[i]; b:=bb[i];
while a<>b do
if a>b then a:=a-b
else b:=b-a;
writeln(f,a) end; close(f); end.