#include <iostream>
using namespace std;
int main()
{
int t, d; //原数字,转换进制
cin >> t >>d;
if (t == 0) //当原数字是 0时,最后结果还是 0
{
cout << 0;
return 0;
}
int s[100];
int i = 0;
while (t != 0)
{
s[i++] = t % d;
t = t / d;
}
for (int j = i - 1; j >= 0; j--)
{
cout << s[j]; //一个个输出
}
return 0;
}
简单编程实现十进制转换任意进制
猜你喜欢
转载自blog.csdn.net/CourserLi/article/details/104270996
今日推荐
周排行