1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream> using namespace std; void foo(int n, int base) { if (n == 0) { cout << endl; return; } foo(n / base, base); cout << n % base; } int main() { int i = 12345; //cin >> i; foo(i, 8); }
1 2
30071