Pagini recente » Cod sursa (job #55298) | Cod sursa (job #714454) | Cod sursa (job #1891199) | Cod sursa (job #724623) | Cod sursa (job #2405188)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int n, sol;
bool f(int, int);
int main()
{
in >> n;
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
{
sol += f(i, j);
}
}
out << sol;
system("pause");
}
bool f(int x, int y)
{
while (x != y)
{
(x > y) ? x -= y : y -= x;
}
return (x == 1);
}