Pagini recente » Cod sursa (job #2894550) | Cod sursa (job #1468321) | Cod sursa (job #1456061) | Cod sursa (job #2389322) | Cod sursa (job #193333)
Cod sursa(job #193333)
#include"stdio.h"
long x;
long out;
int cmmdc(int x,int y)
{
if(y)return cmmdc(y,x%y);
else return x;
}
int val(int x,int y)
{
if(cmmdc(x,y)!=1)return 0;
return 1;
}
int main()
{
freopen("fractii.out","w",stdout);
freopen("fractii.in","r",stdin);
scanf("%ld",&x);
for(int g=1;g<=x;g++)for(int h=1;h<=x;h++)out+=val(g,h);
printf("%ld",out);
return 0;
}