To add a code block, surround it with #+BEGIN_SRC language and #+END_SRC. language should correspond to the major mode for the language in question, e.g. the major mode for Emacs Lisp is emacs-lisp-mode, so write #+BEGIN_SRC emacs-lisp.
#+BEGIN_SRC emacs-lisp
(defun hello-world ()
(interactive)
(message "hello world"))
#+END_SRC
#+BEGIN_SRC python
print "hello world"
#+END_SRC
You can open the code block in a separate buffer by typing C-c ' (for org-edit-special). If you don't have the major mode for the specified language, that will give an error message such as No such language mode: foo-mode.
If the content you want to put in the block is not in any programming language, you can use #+BEGIN_EXAMPLE and #+END_EXAMPLE instead.
#+BEGIN_EXAMPLE
output from a command I just ran
#+END_EXAMPLE
There are easy templates for both of these. At the beginning of the line, type either <s or <e, and then hit TAB. It will expand into a block with begin and end markers for SRC or EXAMPLE, respectively.
These markers are all case insensitive, so you can write #+begin_src etc instead if you prefer.