#include <iostream>
#include <stack>
using namespace std;
int main()
{
int s;
int n;
int k;
cout<<"輸入一個需要轉化進制的整數:"<<endl;
cin>>s;
cout<<"輸入你想要轉化的進制(2-16):"<<endl;
cin>>n;
stack <int> stk;
do
{
stk.push( s % n);
s = s/n;
} while (s!=0);
while(!stk.empty())
{ k = stk.top();
stk.pop();
cout<< k<<" ";
}
return 0;
}


