Pagini recente » Cod sursa (job #2382920) | Cod sursa (job #331172) | Cod sursa (job #1960174) | Cod sursa (job #1995080) | Cod sursa (job #1996437)
#include<iostream>
#include<fstream>
using namespace std;
bool nrPrimeIntreEle(int a, int b){
int r;
do{
r = a%b;
a = b;
b = r;
} while (r != 0);
if (a == 1)
return true;
return false;
}
int main(){
int count = 0;
int n = 0;
ifstream inFile;
inFile.open("fractii.in.txt");
ofstream outFile;
outFile.open("fractii.out.txt");
while (!inFile.eof()){
inFile >> n;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
if (nrPrimeIntreEle(i, j)){
count++;
}
}
}
outFile << count << "\n";
count = 0;
}
outFile.close();
inFile.close();
return 0;
}