ASCII码和数据类型转换.c 272 B

12345678910111213141516171819
  1. #include <stdio.h>
  2. int main() {
  3. int input;
  4. char output[5];
  5. scanf("%d",&input);
  6. int index = 3;
  7. while(input != 0) {
  8. int num = input % 10 + 13;
  9. output[index] = 'A' + (num - 1);
  10. index --;
  11. input /= 10;
  12. }
  13. output[4] = '\0';
  14. printf("%s",output);
  15. return 0;
  16. }