Simple algebra. Plug one of them into the other and simplify:
mv = code * 5000/1024
temp = (mv - 500) / 10
temp*10 = mv - 500
temp*10 = code * 5000/1024 - 500
temp*10 = (code * 5000) / 1024 - 500
(add divisor/2 before performing an integer division for rounding)
temp*10 = (code * 5000 + 512) / 1024 - 500
temp*10 = ((code * 5000 + 512) >> 10) - 500
One multiply, one shift right by 10, one addition, and one subtraction. Then convert to BCD and display it.
However, if you have an 8-bit ADC, you're probably going to want to divide by 256 instead of 1024 (shift right by 8 instead of 10) and add 128 instead of 512.
And here is an algorithm for converting binary to BCD: http://www.eng.utah.edu/~nmcdonal/Tutorials/BCDTutorial/BCDConversion.html
Just run that, split into groups of 4 bits, and drive each digit in the display with one group (after decoding to the proper 7 segment signals, of course).