Cod sursa(job #87751)

Utilizator ApostolacheApostolache Georgiana Victoria Apostolache Data 28 septembrie 2007 21:43:02
Problema Fractii Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.31 kb
var i,j,x,y,nr,n:longint;
    f,g:text;
begin
assign(f,'fractii.in'); reset(f);
assign(g,'fractii.out'); rewrite(g);
read(f,n);
nr:=0;
for i:=1 to n do
for j:=1 to n do begin
x:=i; y:=j;
while x<>y do
if x>y then x:=x-y
else y:=y-x;
if x=1 then inc(nr);
end;
write(g,nr);
close(f); close(g);
end.