Count from 0-9. After 9, make the segment displaying 9 equal to 0 and add a 1 to the segment left of it. Update displays at say 50 mSec to suppress flickering. Remember, human eye can not distinguish flickering if the frequency is greater than 10 Hz.
And lastly, the code you are requesting is not very difficult to try. Better try it yourself. No one can specifically help you because of the following reasons
1. The compiler you are using
2. The crystal
3. Update time interval or condition
4. Version of 8051
5. Nature of displays, (CE or CA)
6. etc, etc
Try the code out yourself