Pagini recente » Cod sursa (job #2908953) | Cod sursa (job #2767622) | Cod sursa (job #884581) | Cod sursa (job #1121604) | Cod sursa (job #571707)
Cod sursa(job #571707)
program euclid2;
var nr,i:longint;
a,b,r:longint;
f,g:text;
function cmmdc(a,b:longint):longint;
begin
if b=0 then
cmmdc:=a
else
cmmdc:=cmmdc(b,a mod b);
end;
begin
assign(f,'euclid2.in');
assign(g,'euclid2.out');
reset(f);
rewrite(g);
readln(f,nr);
for i:=1 to nr do
begin
readln(f,a,b);
writeln(g,cmmdc(a,b));
end;
close(f);
close(g);
end.