Pagini recente » Profil MEENO | Statistici Ciocan Catalin-Iulian (rokosul) | Monitorul de evaluare | Atasamentele paginii Profil Eduardxxx | Cod sursa (job #2147856)
#include <fstream>
using namespace std;
int main()
{
ifstream in("fractii.in");
ofstream out("fractii.out");
int i,j,n,rest,max=0,a,b;
in>>n;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if((i%2==0)&&(j%2==0))
break();
else
if(j==1)
max=max+1;
else
{
a=i;
b=j;
while (b != 0)
{
rest = b;
b = a % b;
a = rest;
}
if (a == 1)
max=max+1;
}
}
}
out<<max;
}