Cod sursa(job #997404)

Utilizator lraduRadu Lucut lradu Data 14 septembrie 2013 00:09:37
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.49 kb
 var   f,g:text;
  n,i,s,j,c:integer;
 begin
 assign (f,'fractii.in'); reset (f);
 assign (g,'fractii.out'); rewrite (g);
 s:=(n-1)*2 +1;
 readln(f,n);
 for i:= 2 to n do
     for j:= 2 to n do begin
    if i=j then c:=1
      else begin
    if i>j then begin if (i+j) mod j=0 then c:=1
                  else c:=0;end;
    if i<j then begin if (i+j) mod i=0 then c:=1
                  else c:=0; end;  end;
    if c=0 then  s:=s+1; end;
 write (g,s);
 close(f); close(g);
 end.