Pagini recente » Borderou de evaluare (job #2319868) | Cod sursa (job #2235655) | Cod sursa (job #1620587) | Cod sursa (job #70397) | Cod sursa (job #543724)
Cod sursa(job #543724)
#include<iostream.h>
#include<fstream.h>
long cmmdc(long x, long y)
{while(x!=y)
if(x>y)
x=x-y;
else
if(x<y)
y=y-x;
return x;
}
int main()
{ int N,nr=0;
ifstream f("fractii.in");
ofstream g("fractii.out");
f>>N;
f.close();
for(int i=1;i<=N;i++)
for(int j=1;j<=N;j++)
if(cmmdc(i,j)==1)
nr++;
g<<nr;
g.close();
return 0;
}