I want to show code in a html page. The code may be written in any language.The output should be as follows:

I want to show code in a html page. The code may be written in any language.The output should be as follows:

All you need to do is write up some CSS (or use inline styling) for the grey background div and then use <span> tags to color the text inside of a <p> tag.
Here is some info on span tags: http://www.w3schools.com/tags/tag_span.asp
Also, you have to replace some characters in the code you want to display. You should replace < with <, and replace > with >. You can put all of that inside of a <code> tag if you would like, but I don't think its necessary.
If you would like it to automatically be colored and formatted and such, then you may need some JavaScript or something, but if it is a static HTML page, then you should just stick with the basics.