One possible solution is to use the sscanf function on the string containing your number, then use one of the thousands algorithms you can find googling on "decimal to hexadecimal conversion algorithm" (if this is the point of your exercise:) and, finally, using the sprintf function to do the conversion from number to string.
If you don't need to exercise on base number conversion, you can just use the %x or %X format specifier in the sprintf format and the magic is done.
It's possible convert between some bases, such as binary and hexadecimal, without converting to a number.
However, if you want to go from decimal to hexadecimal, the only sensible option is to convert it to an integer first.
The only other option I can think of would be to build a huge lookup table, where you search for the input string in the table, and retrieve the corresponding result. But if the input contains many digits, this suggestion is not feasible.