Pagini recente » Cod sursa (job #345097) | Cod sursa (job #1930256) | Cod sursa (job #1033846) | Cod sursa (job #963064) | Cod sursa (job #559769)
Cod sursa(job #559769)
#include<iostream.h>
#include<fstream.h>
int prim(int i, int j)
{int aux;
while(j!=0)
{aux=i%j;
i=j;
j=aux;
}
if(i==1)
return 1;
else return 0;
}
int main()
{int a,i,j,k=0,z=0,i1,j1,aux;
ifstream f("fractii.in",ios::in);
ofstream g("fractii.out",ios::out);
f>>a;
for(i=1;i<=a;i++)
for(j=1;j<=a;j++)
{if(i!=j)
if(prim(i,j)==1)
z++;}
z++;
g<<z;
f.close();
g.close();
return 0;
}