1.First install Greasemonkey script for your Firefox browser.
2.Now click here to install 'Blogger - HTML encode on post edit' to blogger.
This adds a new button at the bottom of your new post area.It encodes the selected text so it can be posted as plain text in Blogger.It will look like this.
When you want to encode some code select it and cick on 'HTML ENCODE SELECTION' button.
Your code will look like this after being encoded:
Now publish your post and see the result.