\documentclass[12pt]{article}
\usepackage{a4}
%\oddsidemargin=-0.25cm
\headsep=-1cm
\textwidth 16cm
\textheight 24cm
\def\picture #1 by #2 (#3){
  \vbox to #2{
    \hrule width #1 height 0pt depth 0pt
    \vfill
    \special{picture #3}
    }
  }
\def\findera{\picture 2in by 1.2in (figure1 scaled 500)}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[french]{babel}
\usepackage{epsfig}
\renewcommand{\baselinestretch}{1}
\newcommand{\bm}[1]{\mbox{\boldmath $ #1 $ }}
\newcommand{\model}[1]{\mbox{\boldmath$#1$\unboldmath}}
\newcommand{\emmodel}[1]{\mbox{\em {\bf #1}}}
\newcommand{\vs}{\vspace{1cm}}
\newcommand{\hs}{\hspace{1cm}}
\newcommand{\pp}{\vspace{6 mm}}
\newcommand{\ov}{\overline}

\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\C}{\mathbb C}

\begin{document}
\pagestyle{empty}
\noindent \rule{16cm}{0.05cm}\\
\noindent {\bf Institut Galilée - Université Paris 13} 
\hfill {\bf Informatique}\\
{\bf DEUG STPI 1ère année}
\hfill{\bf Semaine du 11 octobre 1999}\\
\rule{16cm}{0.05cm}\\

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vs
\begin{center}
{\large {\bf 
T.D.~3 \\
Codage des entiers non sign\'es
}}
\end{center}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vs
\subsection*{Exercice 1. (Changement de base)}

\noindent 
\begin{enumerate}
\item Convertir en binaire les nombres suivants~:\\ 
$25_{10}$ \hs $532_{8}$ \hs $3B9_{16}$
\item Convertir en d\'ecimal les nombres suivants~:\\
$110101_{2}$ \hs $42_{8}$ \hs $101110101_{2}$ \hs $50_{16}$.
\item Convertir les nombres suivants en octal et en hexad\'ecimal~:\\
$100000101_{2}$ \hs $1024_{10}$ \hs $283_{10}$ \hs $50_{10}$.
\item 
Convertir 
$$20110020100220121021221011_{3}$$
en base 9.
\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vs
\subsection*{Exercice 2. (Opérations arithmétiques)}

\noindent 
\begin{enumerate}
\item 
Effectuer les op\'erations suivantes en binaire~: \\
$1100011 + 11001$ \\
$1000000 + 1111111$ \\
$1101 \times 101$
\item 
Effectuer les op\'erations suivantes en hexadécimal~: \\
$1872 + 46C1$\\
$FE3D + AA95$
\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\vs
\begin{center}
{\large {\bf 
T.D.~3 : codage des entiers non sign\'es\\
Corrigé
}}
\end{center}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Exercice 1. (Changement de base)}

\noindent 
\begin{enumerate}
\item Convertir en binaire les nombres suivants~:\\ 
$25_{10} = 11001_2$ \\
$532_{8} = 101 011 010$ \\
$3B9_{16} = 0011 1011 1001$
\item Convertir en d\'ecimal les nombres suivants~:\\
$110101_{2} 
= 1 \cdot 2^5 + 1 \cdot 2^4 + 0 \cdot 2^3 + 1 \cdot 2^2 + 0 \cdot 2^1 + 1 \cdot 2^0 
= 32 + 16 + 4 + 1 = 53_{10}$ \\
$42_{8} = 4 \cdot 8^1 + 2 \cdot 8^0 = 32 + 2 = 34_{10}$ \\
$101110101_{2} 
= 1 \cdot 2^{8} + 0 \cdot 2^{7} + 1 \cdot 2^{6} + 1 \cdot 2^{5} + 1 \cdot 2^{4} 
+ 0 \cdot 2^{3} + 1 \cdot 2^{2} + 0 \cdot 2^{1} + 1 \cdot 2^{0}
= 373_{10}$ \\
$50_{16} = 5 \cdot 16^{1} + 0 \cdot 16^{0} = 80_{10}$.
\item Convertir les nombres suivants en octal et en hexad\'ecimal~:\\
\begin{tabular}{lclcl}
$100000101_{2}$ & $=$ & $100 \; 000 \; 101 \; _{2}$ & $=$ & $405_{8}$ \\
                & $=$ & $1 \; 0000 \; 0101 \; _{2}$ & $=$ & $105_{16}$ 
\end{tabular}
\\
\begin{tabular}{lclclclcl}
$1024_{10}$ &=& $2^{10}$ &=& $2 \cdot \left(2^{3}\right)^{3}$ &=& $2 \cdot 8^{3}$ &=& $2000_{8}$ \\
            &=& $2^{10}$ &=& $4 \cdot \left(2^{4}\right)^{2}$ &=& $4 \cdot 16^{2}$ &=& $400_{16}$ 
\end{tabular}
\\
On conclut grâce à l'unicité de la décomposition.\\
$283_{10} = 433_{8} = 11B_{16}$ \\
$50_{10} = 62_{8} = 32_{16}$
\item 
Convertir $\;20110020100220121021221011_{3}\;$ en base 9.\\
$20110020100220121021221011_{3}$ \\
\begin{tabular}{lccccccccccccc}
= & 
$20$ & $11$ & $00$ & $20$ & $10$ & $02$ & $20$ & $12$ & $10$ & $21$ & $22$ & $10$ & $11 \; _{3}$ \\
= & 
$6$ & $4$ & $0$ & $6$ & $3$ & $2$ & $6$ & $5$ & $3$ & $7$ & $8$ & $3$ & $4 \; _{9}$ \\
\end{tabular}
\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Exercice 2. (Opérations arithmétiques)}

\noindent 
\begin{enumerate}
\item 
Effectuer les op\'erations suivantes en binaire~: \\
\begin{tabular}{lr}
    & $1100011$ \\
$+$ &   $11001$ \\
\hline
    & $1111100$
\end{tabular}
\hs
\begin{tabular}{lr}
    &  $1000000$ \\ 
$+$ &  $1111111$ \\
\hline
    & $10111111$
\end{tabular}
\hs
\begin{tabular}{lccccccc}
         &     &     &     & $1$ & $1$ & $0$ & $1$ \\
$\times$ &     &     &     &     & $1$ & $0$ & $1$ \\
\hline
         &     &     &     & $1$ & $1$ & $0$ & $1$ \\
         &     &     & $0$ & $0$ & $0$ & $0$ &     \\
         &     & $1$ & $1$ & $0$ & $1$ &     &     \\
\hline
         & $1$ & $0$ & $0$ & $0$ & $0$ & $0$ & $1$
\end{tabular}
\\
{\bf
En préparation d'un prochain TD (représentation en machine et dépacement de capacité)
attirer l'attention sur le fait qu'on utilise, par exemple dans l'opération 2, 
un bit en plus pour le résultat.}
\item 
Effectuer les op\'erations suivantes en hexadécimal~: \\
\begin{tabular}{lcccc}
    & $1$ & $8$ & $7$ & $2$ \\
$+$ & $4$ & $6$ & $C$ & $1$ \\
\hline
    & $5$ & $F$ & $3$ & $3$
\end{tabular}
\hs
\begin{tabular}{lccccc}
       &     & $F$ & $E$ & $3$ & $D$ \\
$+$    &     & $A$ & $A$ & $9$ & $5$ \\
\hline
       & $1$ & $A$ & $8$ & $D$ & $2$
\end{tabular}
\end{enumerate}

\end{document}