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