Pagini recente » Cod sursa (job #1422568) | Cod sursa (job #1327861) | Cod sursa (job #1153217) | Cod sursa (job #1153263) | Cod sursa (job #328883)
Cod sursa(job #328883)
#include<iostream.h>
#include<fstream.h>
long cmmdc(long a,long b)
{if (b==0)
return a;
else
return cmmdc(b,a%b);
}
long n;
int main()
{ifstream fin("fractii.in");
fin>>n;
fin.close();
ofstream fout("fractii.out");
long i,j,nr;
nr=1;
for(i=2;i<=n-1;i++)
{//fout<<i-1<<" "<<nr<<"\n";
for(j=1;j<=i-1;j++)
if(cmmdc(i,j)==1)
// fout<<i<<'/'<<j<<" ";
//else
nr+=2;
}
fout<<nr;
fout.close();
return 0;
}