Pagini recente » Monitorul de evaluare | Cod sursa (job #160400) | Cod sursa (job #1048052) | Cod sursa (job #660865) | Cod sursa (job #823170)
Cod sursa(job #823170)
#include<iostream>
#include<fstream>
using namespace std;
int cmmdc(long x,long y)
{
if(x>1&&y>1)
for(long i=x;i>=2;i=i-1)
if((x%i==0)&&(y%i==0))
return 0;
return 1;
}
void main()
{
long N,nr=0;
ifstream f_in;
fstream f_out;
f_in.open("fractii.in");
f_out.open("fractii.out");
f_in>>N;
for(long i=1;i<=N;i=i+1)
for(long j=1;j<=N;j=j+1)
if(cmmdc(i,j))
{
//f_out<<i<<"/"<<j<<" ";
nr++;
}
f_out<<nr<<endl;
}