Pagini recente » Cod sursa (job #3131483) | Cod sursa (job #3241431) | Cod sursa (job #283579) | Cod sursa (job #2058683) | Cod sursa (job #193330)
Cod sursa(job #193330)
#include"stdio.h"
long x;
long out;
int cmmdc(int x,int y)
{
int a;
if(y<x){a=x;x=y;y=a;}
for(long g=1;g<=x;g++)
if((x/g)*g==x && (y/g)*g==y)
a=g;
return a;
}
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;
}