Cod sursa(job #997407)

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