Challenge: Print Base 16 Integers

Try solving the problem of converting an integer of base 10 to base 16. Check if you can solve this problem using recursion.


Given an integer in decimal form, print its hexadecimal form. Use recursion to solve the problem.


An integer.


A string of the hexadecimal form of an integer.

Sample input


Sample output


Coding exercise

Try to solve this yourself first. If you get stuck or need help, you can always press the “Show Solution” button to see how your problem can be solved. We’ll look at the solution in the next lesson.

Good luck!

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.