Pagini recente » Cod sursa (job #2329941) | Cod sursa (job #2338638) | Cod sursa (job #2030520) | Cod sursa (job #1334821) | Cod sursa (job #2440519)
#include <iostream>
#include <fstream>
using namespace std;
bool eReductibila(int a, int b) {
int x = a, y = b;
while (x != y) {
if (x > y)
x = x - y;
else
y = y - x;
}
if (x == 1)
return false;
return true;
}
int main() {
ifstream fin("fractii.in.txt");
ofstream fout("fractii.out.txt");
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;
system("pause");
return 0;
}