Răspuns:
program cmmdcPerechi;
var a,b,r:integer;
f:text;
begin
assign(f,'in.txt'); reset(f);
while (not eof(f)) do
begin
readln(f,a,b);
r:= a mod b;
while r <> 0 do
begin
a:=b;
b:=r;
r:=a mod b;
end;
writeln(b);
end;
writeln;
close(f);
end.
Explicație: