fork download
  1. #include <stdio.h>
  2. int hex(int p){
  3. if(p==10)
  4. printf("A");
  5. else if(p==11)
  6. printf("B");
  7. else if(p==12)
  8. printf("C");
  9. else if(p==13)
  10. printf("D");
  11. else if(p==14)
  12. printf("E");
  13. else if(p==15)
  14. printf("F");
  15. else
  16. printf("%d", p);
  17. }
  18.  
  19. int tohex(int n){
  20. if(n>15){
  21. tohex(n/16);
  22. hex(n%16);
  23. }
  24. else{
  25. hex(n);
  26. }
  27.  
  28. }
  29.  
  30.  
  31.  
  32. int main(void) {
  33. int a;
  34. scanf("%d", &a);
  35. tohex(a);
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0s 5316KB
stdin
255
stdout
FF