#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
char c[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char d[8] = {0};
int n, t;
int i = 0;
if (0 == (n = atoi(argv[1])))
{
printf("Please input a number.\n");
return 0;
}
t = n;
while (t > 0)
{
d[i++] = c[t%16];
t = t/16;
}
printf("%d --> 0x", n);
for (i = 8-1; i >= 0; i--)
{
if (0 != d[i])
{
printf("%c", d[i]);
}
}
printf("\n");
return 0;
}