There is a tutorial on WordPress which explains how to post source code in wordpress posts which is hard to find via Google search.
All you need to do is to surround source code in
[sourcecode] insert source code here [\ sourcecode]
WordPress will automatically recognize this and will parse accordingly.
You can specify language e.g. php, css, javascript etc as followings:
[sourcecode language=”css” ] insert source code here[\ sourcecode]
Here is how it looks
The following is a simple link
MLB
Following is a the source code for above link which is displayed using sourcecode formatting.
<a title="MLB" href="http://www.mlb4all.com" target="_blank">MLB</a>
u can use a simple online app, TOHTML
here u can enter the source code , select the language and style and get html code ,that u can paste in the editor to get a formatted code, i have used it and it also highlights different syntax.