Cod sursa(job #2215269)
| Utilizator | Data | 21 iunie 2018 15:20:23 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream in;
in.open("fractii.in");
ofstream out;
out.open("fractii.out");
int nr,suma = 0;
in >> nr;
for(int i = 1 ; i <= nr ; i++ ){
for( int j = 1; j <= nr ; j++){
int aux = 0;
for(int k = 2; k <= j ; k++)
if(i % k == 0 && j % k == 0)
aux = 1;
if(aux == 0) suma++;
}
}
out << suma << endl;
return 0;
}
