Pagini recente » Cod sursa (job #732610) | Cod sursa (job #1748519) | Cod sursa (job #3145750) | Cod sursa (job #1322731) | Cod sursa (job #1996412)
#include<iostream>
#include<fstream>
using namespace std;
bool nrPrimeIntreEle(int a, int b);
int main(){
int count = 0;
int n = 0;
int a = 0;
int b = 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++){
a = i;
b = j;
while (a != b){
if (a > b){
a = a - b;
}
else{
b = b - a;
}
}
if (a == 1){
count++;
}
}
}
outFile << count << "\n";
count = 0;
}
outFile.close();
inFile.close();
return 0;
}