Octal %o and Hexadecimal %x

On my previous posts have discussed several determinants formats are briefly described here and here
Further discussion will be explained in my post this time,
the example simple program that displays % o (octal displays an integer value) and % x (hexadecimal value displays integer).

    
* Displays Octal Value (% o)
# include
play ()(
    
int o;

    
printf ( "input decimal values?");

   
scanf ( "% d", & O);

   
printf ( "octal value =% o \ n", O))


results that look like the following:

input decimal value? 4567
octal value = 10,727



    
* Displays the hexadecimal value (% x)

      
# include
      
main ()
      
(
          
int A;
          
printf ( "input values?");
         
scanf ( "% d", & A)
         
printf ( "hexadeciaml value = % x \ n", A)
      
)

      
results:


      
input decimal value? 4567
     
hexadecimal value = 11d7

0 comments

Posting Komentar