Pagini recente » Cod sursa (job #434760) | Cod sursa (job #2882176) | Monitorul de evaluare | Cod sursa (job #2158178) | Cod sursa (job #485628)
Cod sursa(job #485628)
var T, i : integer ;
A, B : longint ;
function ggt ( a , b : longint ) : longint;
begin
while a <> b do
if a > b then a := a - b
else b := b - a ;
ggt := a
end ;
begin
assign ( input, 'euclid2.in' ) ; reset ( input ) ;
assign ( output, 'euclid2.out' ) ; rewrite ( output ) ;
readln ( T ) ;
for i := 1 to T do
begin
readln ( A, B ) ;
writeln ( ggt ( A, B ) ) ;
end ;
close ( input ) ; close ( output ) ;
end .