% Author Info
\def\thetitle{HW3 Algorithms}
\def\theclass{CS105}
\def\university{University of Massachusetts Boston}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You can ignore all this stuff for now
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[12pt,letterpaper]{article}

\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{setspace}
\usepackage{Tabbing}
\usepackage{lastpage}
\usepackage{extramarks}
\usepackage{chngpage}
\usepackage{soul,color}
\usepackage{graphicx,float,wrapfig}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{url}
\usepackage{scalefnt}
%Tikz
\usepackage{tikz}
\usetikzlibrary{trees,snakes}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{matrix}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{chains,positioning,scopes}



\setlength{\parskip}{0pt} % 1ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}

% Increase to 2.0 for double spacing.
\linespread{1}

% Header & Footers
% LaTeX has very generous margins, by default.
% I've shrunk the margins, considerably.
\usepackage[hmargin=2cm,vmargin=3.5cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\thetitle}
\chead{}
\rhead{\theclass}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}

\begin{document}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You work below this part
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% $\lnot \Box$
% 
% $\diamondsuit$
% 
% $\bigcirc$


Name:

UMS ID:

Note: You must turn in a hardcopy at the beginning of class. Please show all the steps for your work to get maximum points.
\vspace{10pt}

Convert the following base 2 numbers to ASCII strings


01101000 01101001 

\vspace{70pt}



01101000 01110111 00110011 

\vspace{70pt}

Write what is printed by the following statements.

1. 

\begin{algorithm}


\For{$i = 0 ; i < 5; i=i+1$}{

print $i$

}

\end{algorithm}


\vspace{70pt}


2. 

\begin{algorithm}


\For{$i = 0 ; i > 5; i=i+1$}{

print $i$

}

\end{algorithm}


\vspace{70pt}



\newpage

3. 

\begin{algorithm}


\For{$i = 8 ; i > 5; i=i+1$}{

print $i$

}

\end{algorithm}

\vspace{70pt}





4. 

\begin{algorithm}


\For{$i = 70 ; i \leq 73; i=i+1$}{

print $i$

}

\end{algorithm}

\vspace{70pt}



5. 

\begin{algorithm}


\For{$i = 1 ; i \leq 6; i=i+1$}{

\If{$i > 4$}{

print $i$

}
}

\end{algorithm}

\vspace{70pt}






\newpage
6. 

\begin{algorithm}

$i = 1$

\While{$i \leq 6$}{

\If{$i > 4$}{

print $i$


}\Else{

print ``Hello''

}

$i=i+1$
}

\end{algorithm}

\vspace{70pt}







7. 

\begin{algorithm}

\For{$i = 1 ; i \leq 6; i=i+1$}{

print $(7 - i)$

}

\end{algorithm}

\vspace{70pt}


8. 

\begin{algorithm}

\For{$i = 1 ; i \leq 3; i=i+1$}{

\For{$j = 1 ; j \leq 3; j=j+1$}{

print $(j - i)$


}
}

\end{algorithm}

\vspace{70pt}




\end{document}