Converting a Number into its equivalent Hexadecimal and Octal notations in C


#include<stdio.h>
main()
  {
   int number;
   printf("enter number:");
   scanf("%d",&number);
   printf("Given number in Hexadecimal is %x",number);  /*here format specifier %x is used to convert the                          
                                                                                             number into hexadecimal*/     
                
   printf("Given number in Octal is %o",number); /*here format specifier %x is used to convert the 
                                                                               number into Octal*/
  }


The format specifiers %x,%o can also be used to read values


Share on Google Plus
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment