#include <iostream>
using namespace std;
#define N 16 //用来做除数
int main(int argc, char** argv) {
int count=0; //用来计数,为后循环做限制,记录余数个数,有一个余数,count++
int a[100]; //定义一个数组,用来存放余数,
//注意最后输出余数时应从后往前输出,即下标大的应该先输出来
int n; //用户输入需要进行转换的数
cin>>n;
int shang,yushu; //定义商和余数
using namespace std;
#define N 16 //用来做除数
int main(int argc, char** argv) {
int count=0; //用来计数,为后循环做限制,记录余数个数,有一个余数,count++
int a[100]; //定义一个数组,用来存放余数,
//注意最后输出余数时应从后往前输出,即下标大的应该先输出来
int n; //用户输入需要进行转换的数
cin>>n;
int shang,yushu; //定义商和余数
shang=n/N;
yushu=n%N;
a[count]=yushu;
count++;
while(shang>=16){
n=shang; //n除以十六后,注意要把n的值改变 ;否则shang,yushu 的值永远不会变化。
shang=n/N;
yushu=n%N;
a[count]=yushu;
count++;
}
if(shang>9){
switch(shang){
case 10:cout<<"A";break;
case 11:cout<<"B";break;
case 12:cout<<"C";break;
case 13:cout<<"D";break;
case 14:cout<<"E";break;
case 15:cout<<"F";break;
}
}else{
cout<<shang;
}
yushu=n%N;
a[count]=yushu;
count++;
while(shang>=16){
n=shang; //n除以十六后,注意要把n的值改变 ;否则shang,yushu 的值永远不会变化。
shang=n/N;
yushu=n%N;
a[count]=yushu;
count++;
}
if(shang>9){
switch(shang){
case 10:cout<<"A";break;
case 11:cout<<"B";break;
case 12:cout<<"C";break;
case 13:cout<<"D";break;
case 14:cout<<"E";break;
case 15:cout<<"F";break;
}
}else{
cout<<shang;
}
for(int i=count-1;i>=0;i--){
if(a[i]>9){
switch(a[i]){
case 10:cout<<"A";break;
case 11:cout<<"B";break;
case 12:cout<<"C";break;
case 13:cout<<"D";break;
case 14:cout<<"E";break;
case 15:cout<<"F";break;
}
}else{ cout<<a[i];}
}
return 0;
}
if(a[i]>9){
switch(a[i]){
case 10:cout<<"A";break;
case 11:cout<<"B";break;
case 12:cout<<"C";break;
case 13:cout<<"D";break;
case 14:cout<<"E";break;
case 15:cout<<"F";break;
}
}else{ cout<<a[i];}
}
return 0;
}