fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. void convert(int);
  4.  
  5. int main()
  6. {
  7. convert(12);
  8. }
  9.  
  10.  
  11. void convert(int n)
  12. {
  13. int i,r ,arr[50];
  14.  
  15.  
  16. for( i = 0; n != 0 ;i++)
  17. {
  18. r = n%2;
  19. arr[i] = r;
  20.  
  21. n = n/2;
  22. }
  23.  
  24. for(i = i-1 ; i>=0 ;i--)
  25. {
  26.  
  27. printf("%x",arr[i]);
  28. }
  29.  
  30. }
Success #stdin #stdout 0.01s 5292KB
stdin
45
stdout
1100