Pagini recente » Cod sursa (job #658090) | Cod sursa (job #811900) | Cod sursa (job #2046540) | Diferente pentru problema/rollercoaster intre reviziile 32 si 5 | Cod sursa (job #2434243)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fractii.in");
ofstream g("fractii.out");
int main()
{
int n, i, j, t, d, nrf=0;
f >> n;
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++)
{
d = 0;
for (t = 1; t <= max(i,j); t++)
{
if( i % t == 0 && j % t==0)
d++;
}
if (d == 1)
nrf++;
}
g << nrf;
}