Cod sursa(job #386450)
Utilizator | Data | 24 ianuarie 2010 20:31:55 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
var f,g:text; i,t,a,b,c:integer;
begin
assign(f,'euclid2.in'); reset(f);
assign(g,'euclid2.out'); rewrite(g);
read(f,t);
for i:=1 to t do begin
read(f,a,b);
while b<>0 do
begin
c:=a mod b;
a:=b;
b:=c;
if b=0 then writeln(g,a);
end;
end;
close(f);
close(g);
end.