Cod sursa(job #2045263)
Utilizator | Data | 21 octombrie 2017 23:57:38 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.61 kb |
Program euclid2;
var f, g:text;
a, b, c, j, i, t:longint;
begin
assign(f, 'euclid2.in');
assign(g, 'euclid2.out');
reset(f); rewrite(g);
readln(f, t);
For i:=1 to t do begin read(f, a); readln(f, b);
if a>b then c:=a
else c:=b;
For j:=c downto 1 do if (a mod j=0) and (b mod j=0) then begin writeln(g, i);
break;
end;
end;
close(f); close(g);
end.