Pagini recente » Cod sursa (job #2406809) | Cod sursa (job #836243) | Cod sursa (job #3032044) | Diferente pentru problema/sr intre reviziile 14 si 3 | Cod sursa (job #694575)
Cod sursa(job #694575)
function cmmdc(a,b:longint):longint;
var t:longint;
begin
while b<>0 do
begin
t:=b;
b:=a mod b;
a:=t;
end;
cmmdc:=a;
end;
var a,b,t,i:longint;
f1,f2:text;
begin
assign(f1,'euclid2.in');
assign(f2,'euclid2.out');
reset(f1); rewrite(f2);
readln(f1,t);
for i:=1 to t do
begin
read(f1,a,b);
writeln(f2,cmmdc(a,b));
readln(f1);
end;
close(f1);
close(f2);
end.