Cod sursa(job #143338)

Utilizator andumMorie Daniel Alexandru andum Data 26 februarie 2008 12:41:49
Problema Algoritmul lui Euclid Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.35 kb
var a,b,r:longint;   
    f,g:text;   
begin  
assign(f,'euclid2.in');   
assign(g,'euclid2.out');   
reset(f);   
rewrite(g);   
readln(f,a,b);
r:=a mod b;
while r<>0 do begin
              a:=b;
              b:=r;
              r:=a mod b;
              end;
if b=1 then write(g,'1')
       else write(g,b);
close(f);
close(g);   
end.