Pagini recente » Cod sursa (job #2807580) | Cod sursa (job #3153379) | Cod sursa (job #1522766) | Cod sursa (job #66564) | Cod sursa (job #193329)
Cod sursa(job #193329)
#include"stdio.h"
int x;
long out;
int cmmdc(int x,int y)
{
int a;
if(y<x){a=x;x=y;y=a;}
for(int 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("%d",&x);
for(int g=1;g<=x;g++)for(int h=1;h<=x;h++)out+=val(g,h);
printf("%d",out);
return 0;
}