. 1 #include <stdio.h> 2 . 3 int main ( void ) . 4 { . 5 the printf ( " % D%% O X \ n- " , 10 , 10 , 10 ); // output is octal% o, not 0 . 6 the printf ( " % D%% X-O \ n- " , 10 , 10 , 10 ); // % X, uppercase hexadecimal value of X, the output is uppercase . 7 the printf ( " % D%% # # O X \ n- " , 10 , 10 , 10); // add #, allowing front octal and hexadecimal number prefix . 8 the printf ( " % D% #% # X-O \ n- " , 10 , 10 , 10 ); . 9 return 0 ; 10 }
Display decimal, octal and hexadecimal
Guess you like
Origin www.cnblogs.com/2018jason/p/12006554.html
Recommended
Ranking