can 开发者_运维问答you please tell me
How to use printf to find out the hex and octal values of 255?
Thanks a lot.
Try using the o and x specifier of printf
printf("%d %o %x",255,255,255); // prints 255 377 ff
If you want to do this on shell you can do:
$ printf "%o\n" 255
377
$ printf "%x\n" 255
ff
$ 
Try this:
printf("%x", 255);  /* print hex representation of decimal 255 */
printf("%o", 255);  /* print octal representation of decimal 255 */
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论