Adding code box to write a coding is quite simple in wordpress blogs. You can use any of three tags to writing code within. These are <code>, <tt> and <pre> tag. Using <code> and <pre> tag you can simply differentiate between the code you write and the rest of the text content in your post.
This is an example of <code> tag.
This is an example of <tt> tag.
But, by using <pre> tag, you can define a box in which your code will be displayed.
This is <pre> tag example.
Also, you can change the style/layout of <pre> tag by changing it’s style.css stylesheet file located in your current WordPress theme directory.