#include<stdio.h>#include<string.h>void changing(char a[],int n);void change(int a){ int i,b,c=0; char array[100]; b=a; do { i=b%16; b/=16; switch(i) { case 10: array[c]='A'; break; case 11: array[c]='B'; break; case 12: array[c]='C'; break; case 13: array[c]='D'; break; case 14: array[c]='E'; break; case 15: array[c]='F'; break; default: array[c]=i+48; } c++; }while(b!=0); b=strlen(array); changing(array,b); puts(array);}void changing(char a[],int n){ int i; char temp; for(i=0;i<(double)n/2;i++) { temp=*(a+i); *(a+i)=*(a+n-i-1); *(a+n-i-1)=temp; }}int main(){ int a; scanf("%d",&a); change(a); return 0;}
添加回答
举报
0/150
提交
取消