Cod sursa(job #366996)

Utilizator remus_maziluRemus Mazilu remus_mazilu Data 22 noiembrie 2009 11:58:11
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include<iostream.h>
#include<fstream.h>
fstream in("fractii.in",ios::in), out("fractii.out",ios::out);
int cmmdc(int a,int b)
{  int c;
 while(b>0){ 
 c=a%b; 
 a=b; 
 b=c; 
}
return a;
}
main()
{
long n,i,j,x=0,y;
in>>n;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
	{ y=cmmdc(i,j);
	if (y==1) x++;
	}
out<<x;
}