How to display hexadecimal numbers in C?

前端 未结 4 1041
感动是毒
感动是毒 2020-12-07 15:27

I have a list of numbers as below:

0, 16, 32, 48 ...

I need to output those numbers in hexadecimal as:

00

4条回答
  •  自闭症患者
    2020-12-07 16:09

    Your code has no problem. It does print the way you want. Alternatively, you can do this:

    printf("%04x",a);
    

提交回复
热议问题