![:wink:](./images/smilies/icon_wink.gif)
![:wink:](./images/smilies/icon_wink.gif)
Code: Select all
#include <iostream>
using namespace::std;
int almacen()
int gcd(register int a, register int b){
register int t;
while (b != 0){
t = b;
b = a%b;
a = t;
}
return a;
}
bool resolver(int &numero){
int cantidad=0;
for (int d=1 ; true ; d++){
for (int n=0; n<=d ; n++){
if (gcd(n,d)==1)
++cantidad;
if (cantidad==numero){
cout << n << "/" << d << endl;
return true;
}
}
}
return true;
}
int main(){
int numero;
while ((cin >> numero) && (numero!=0))
resolver(numero);
return 0;
}