Cod sursa(job #365568)
Utilizator | Data | 19 noiembrie 2009 12:14:38 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
var a,b,n,i:byte;
f,g:text;
function cmmdc(a,b:byte):byte;
var t: byte;
begin
while b<>0 do
begin
t:=b;
b:=a mod b;
a:=t;
end;
cmmdc:=a;
end;
BEGIN
assign(f,'euclid2.in');
reset(f);
assign(g,'euclid2.out');
rewrite(g);
readln(f,n);
for i := 1 to n do
begin
read(a); readln(b);
writeln(g,cmmdc(a,b));
end;
end.