Cod sursa(job #134183)

Utilizator alexu128Rosu Alexandru alexu128 Data 10 februarie 2008 20:29:59
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.41 kb
var x,y,n,i,j,nr:integer;  f,t:text;
begin
     assign(f,'fractii.in');
     reset(f);
     readln(f,n);
     close(f);
     assign(t,'fractii.out');
     rewrite(t);
     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
     nr:=nr+1;
     end;
     write(t,nr);
     close(t);
     end.