Someone will help you if you show some interest. So far you've only shown you need the solution and that you don't care how it works. The circuit diagram was posted for you.
Do you know how a 7-segment display works?
Do you know how to write a value to a port?