Pagini recente » Cod sursa (job #3270107) | Istoria paginii utilizator/keepoutzone | Cod sursa (job #1297934) | Cod sursa (job #593548) | Cod sursa (job #1509740)
#include <iostream>
#include <fstream>
std::ifstream fin("fractii.in");
std::ofstream fout("fractii.out");
int n, x, y, numar = 0;
int main(int argc, char *argv[])
{
fin >> n;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
x = i;
y = j;
while(x!=y){
if(x>y)
x=x-y;
else
y=y-x;
}
if(x==1)
numar++;
}
}
fout << numar;
return 0;
}