Pagini recente » Cod sursa (job #710957) | Cod sursa (job #1573498) | Clasament Urmasii lui Moisil 2016 Clasa 9 | Cod sursa (job #3291943) | Cod sursa (job #111449)
Cod sursa(job #111449)
using namespace std;
#include<iostream>
#include<stdio.h>
int main()
{
freopen("fractii.in", "r", stdin);
freopen("fractii.out", "w", stdout);
long n,a,as,b,i,j,c;
cin>>n;
c=0;
for(i=1; i<=n; i++)
{
a=i;
as=i;
for(j=1; j<=n; j++)
{
b=j;
a=as;
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
if(a==1)
c++;
}
}
cout<<c;
return 0;
}