Cod sursa(job #345150)

Utilizator FLORINSTELISTUOprea Valeriu-Florin FLORINSTELISTU Data 1 septembrie 2009 21:25:15
Problema Fractii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.45 kb
program fractii;
   var  n,p,q,i,l,max:longint;f,g:text;a:byte;
   begin
   assign(f,'fractii.in');reset(f);
   assign(g,'fractii.out');rewrite(g);
   readln(f,n);
   while p<n do begin
   inc(p);q:=0;
   while q<n do begin
   inc(q);if p>q then max:=p else max:=q;i:=2;
   while i<=max do begin
   if (p mod i=0)and(q mod i=0)then a:=1;inc(i);end;
   if a=0 then inc(l); a:=0;
   end;
   end;
   write(g,l);
   close(f);
   close(g);
   end.