First, the simplest way is to use the # button to wrap code tags around a selection.
The beginning tag does not have a / slash before the term, only the closing tag.
You can get even more formatting controls by using the "Go Advanced" button at the bottom-right of the posting window.
The above assumes that your question is about putting your code in a post here, not in a Word document.
In a Word document, I use a custom paragraph style named Code.
Body Text is my base style. Use Body Text Style Instead of Normal Style