Pagini recente » Cod sursa (job #2668848) | Cod sursa (job #3193052) | Cod sursa (job #257249) | Cod sursa (job #1498613) | Cod sursa (job #2440529)
#include <iostream>
#include <fstream>
using namespace std;
bool eReductibila(int a, int b) {
int x = a, y = b, c;
while (y) {
c = x % y;
x = y;
y = c;
}
if (x == 1)
return false;
return true;
}
int main() {
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n;
fin >> n;
int rez = 0;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
if (!eReductibila(i, j))
++rez;
fout << rez;
return 0;
}