Cod sursa(job #2338152)
Utilizator | Data | 7 februarie 2019 09:10:52 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
program loc;
var a,b,c,n,i,j,m:integer;
f,g:text;
begin
assign(g,'euclid2.in');
assign(f,'euclid2.out');
reset(g);
rewrite(f);
readln(g,n);
for j:=1 to n do begin
readln(g,a,b);
if a>b then c:=b else c:=a;
for i:=c downto 1 do begin
if (a mod i=0) and (b mod i=0) then begin writeln(f,i); break; end;
end;
end;
close(f);
close(g);
end.