BoBo写了一个十六进制整数ABCDEF,他问KiKi对应的十进制整数是多少。
#include <stdio.h> int main() { printf("%15d",0XABCDEF); return 0; }
#include<stdio.h> int main() { int c=0xABCDEF; printf("%15d",c); return 0; }
#include<stdio.h> #include<math.h> int main() { char ch[] = "ABCDEF"; int i = 0, num = 0,j=0; for (i = 5; i >= 0; i--) { int tem = 0; tem = ((ch[i] - 'A') + 10) * (int)pow(16, j); num += tem; j++; } printf("%15d", num); return 0; }