\documentclass{article}

\usepackage{amsmath}
\usepackage{listings}
%\usepackage{framed}
\usepackage{amssymb}
\usepackage{graphicx}

\addtolength{\textwidth}{1in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\textheight}{1in}
\addtolength{\topmargin}{-0.5in}

\begin{document}

\noindent
\centerline{\Large\bf 22C:16 (CS:1210) Quiz 1}

\medskip

\medskip
\hrule

\medskip
\noindent
You have 20 minutes to complete this quiz.

\noindent
\begin{enumerate}
\item
This is our first Python program, \texttt{intToBinary1.py}.
What output does it produce for input 21?
%\begin{framed}
\begin{verbatim}
n = int(raw_input("Type a nonnegative integer. "))
while n > 0:
    print n%2
    n = n/2
\end{verbatim}
%\end{framed}

\vspace{1in}

\item Consider the following program. 
What output does it produce for input 3691?
%\begin{framed}
\begin{verbatim}
number = int(raw_input("Enter a number: "))
while number > 0:
        print number % 100
        number = number / 10
\end{verbatim}
%\end{framed}

\vspace{1in}

\item Consider the following program. 
What output does  it produce?
%\begin{framed}
\begin{verbatim}
n = 21
while n > 0:
    print n 
    n = n/3 + n%2
\end{verbatim}
%\end{framed}

\vspace{1in}

\newpage

\item
I want to write a program that reads a positive integer, say $n$, and prints
all whole numbers from $n$ down to 0. So for example if the input is 5, then 
the output of my program should be
\begin{verbatim}
5
4
3
2
1
0
\end{verbatim}
Here is my attempt at writing this program. The program has 3 errors.
Fix the errors and rewrite the program in the space given below
%\begin{framed}
\begin{verbatim}
n = raw_input("Enter a positive integer: ")
while n > 0:
    print n
    n = n + 1 
\end{verbatim}
%\end{framed}

\vspace{2in}

\end{enumerate}


\medskip
\hrule
\end{document}
