#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int main()
{
    //十进制转换为若干进制>2,<16 =
    int num;
    int n;//2-16之间
    int a;
    int i=0;
    cin>>num>>n;
    int s[100];
    if(n>=2&&n<<16)
    {
       while(num!=0)
       {
           a=num%n;
           num=num/n;
           i++;
           s[i]=a;

       }
       for(int j=i;j>=1;j--)
       {
           if(s[j]>=10)
           {
               cout<<s[j]+55;
           }
           else{
            cout<<s[j];
           }
       }
    }
    else{

        cout<<"error"<<endl;
    }
}

 

相关文章:

  • 2021-12-01
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-28
  • 2021-12-01
猜你喜欢
  • 2021-11-03
  • 2021-08-16
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案