Pagini recente » Cod sursa (job #2806922) | Cod sursa (job #3151795) | Cod sursa (job #277378) | Cod sursa (job #699399) | Cod sursa (job #15210)
Cod sursa(job #15210)
var m,n,nr,c,i:longint;
fin,fout:text;
este:boolean;
Begin
Assign(fin,'fractii.in');Reset(fin);
Assign(fout,'fractii.out');Rewrite(fout);
nr:=0;
ReadLn(fin,c);
For m:=1 to c do
For n:=1 to c do
Begin
este:=true;
if(m<>n) then Begin
if (m>n) then For i:=m downto 2 do
if(m mod i=0)and(n mod i=0)then Begin
este:=false;break;
End;
if (m<n) then For i:=n Downto 2 do
if(m mod i=0)and(n mod i=0)then Begin
este:=false;break;
End;
End;
if(m=n)and(m<>1)then este:=false;
if este then inc(nr);
End;
WriteLn(fout,nr);
close(fout);
End.