Pagini recente » Cod sursa (job #2649424) | Cod sursa (job #2434533) | Cod sursa (job #1090514) | Cod sursa (job #952503) | Cod sursa (job #875819)
Cod sursa(job #875819)
#include<stdio.h>
long o,n;
long cmmdc(long x, long y)
{ while(x!=y)
if(x>y)
x=x-y;
else
y=y-x;
return x;
}
int main()
{
FILE *f;
f=fopen("fractii.in","rt");
fscanf(f, "%d", &n);
fclose(f);
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(i%j==0);
else
if(cmmdc(i,j)==1)
o++;
f=fopen("fractii.out","wt");
fprintf(f,"%d", o+n);
fclose(f);
return 0;
}