\documentclass{article}

\usepackage{listings}

\lstset{basicstyle=\footnotesize, tabsize=3, numbers=left, stepnumber=1}
\lstdefinelanguage{none}{morekeywords={thisisnotakeyword}}
\lstdefinelanguage{mylanguage}{morekeywords={func, end, int, bool, array, of,
record, type, var, return, write, allocate, if, then, while, do, length,
else, true, false, null, break, continue},
morecomment=[l]{\#}, morecomment=[n]{(*}{*)} }

\begin{document}

\subsection*{C Programs}

\lstset{language=C}
\lstinputlisting{program.c}
\bigskip
% Code can also be written directly in the latex document, using
%\begin{lstlisting}
%  code
%\end{lstlisting}

\subsection*{Program Output}

\lstset{language=none}
\lstinputlisting{program.output}
\bigskip

\subsection*{Defining Another Language}

\lstset{language=mylanguage}
\lstinputlisting{Factorial.txt}
\bigskip

\end{document}
