Pagini recente » Cod sursa (job #798852) | Statistici Musat Florin (fifimusat) | Cod sursa (job #1183446) | Cod sursa (job #1103570) | Cod sursa (job #2215269)
#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;
}