Pagini recente » Cod sursa (job #2633190) | Cod sursa (job #2554168) | Cod sursa (job #636027) | Cod sursa (job #1892477) | Cod sursa (job #2254675)
#include <fstream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
bool PrimeIntreEle(int x, int y)
{
int r;
r = x%y;
while(r!=0)
{
x=y;
y=r;
r=x%y;
}
if(y==1) return true;
return false;
}
int main()
{
int n,valor;
fin>>n;
int nr = 0;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
{
valor = PrimeIntreEle(i, j);
if(valor)
{ nr++;
}
}
fout<<nr;
return 0;
}