Mai intai trebuie sa te autentifici.
Cod sursa(job #2325355)
Utilizator | Data | 22 ianuarie 2019 16:07:05 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
program Ex1;
var
f, g: text;
T, a, b, i:BigInteger ;
function cmmdc(x, y: BigInteger): BigInteger;
begin
while x <> y do
if x>y then x:=x-y else y:=y-x;
cmmdc:=x;
end;
begin
assign(f, 'euclid2.in'); reset(f);
readln(f, t);
assign(g, 'euclid2.out'); rewrite(g);
for i := 1 to t do
begin
Readln(f, a, b);
writeln(g, cmmdc(a, b));
end;
close(f);
close(g);
end.