Cod sursa(job #1987916)
| Utilizator | Data | 1 iunie 2017 15:01:51 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
int fractieir(int a, int b)
{
int x = 2;
while(x <= a && x <= b)
{
if(a%x == 0 && b%x == 0)
return 0;
x++;
}
return 1;
}
int main()
{
int n, k = 0;
ifstream f("fracti.in");
ofstream g("fracti.out");
f >> n;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
if(fractieir(i, j))
k++;
g << k;
return 0;
}
