verbatimbox to place it in a box at a reduced size. Further downsizing of the box is possible with a
\scalebox. Whereas a box will not break across a page boundary, the package also offers "nobox" versions of some of its macros, that will break across a page. However, the boxed feature is nice for including verbatim in figures, tables, and moving it right on the line or centering it.
In this MWE, I have manually added
\fbox enclosures around all the verbatim boxes, for clarity, but they are not part of the verbatim-box.
With verbatimbox, you can tell the macro to make the code ``footnotesize.''\par
Here is my input code text
Line two of my $%& code text
If it is from a file, I can do that, too, this time \verb|\scriptsize|:\par
Alternately, you could shrink it further with a \verb|\scalebox|:\par
If you have need to break across pages, the package offers ``nobox'' versions
of some of its macros.
There is also the
numberedblock package (http://ctan.org/pkg/numberedblock)that allows formatting small code blocks in a manner such as (note: image taken from package docs):