53 lines
979 B
TeX
53 lines
979 B
TeX
|
\documentclass[a4paper,10pt]{article}
|
||
|
\usepackage{myXsim}
|
||
|
|
||
|
\author{Benjamin Bertrand}
|
||
|
\title{Programmation - Cours}
|
||
|
\date{Février 2022}
|
||
|
|
||
|
\pagestyle{empty}
|
||
|
|
||
|
\begin{document}
|
||
|
|
||
|
\maketitle
|
||
|
\setcounter{section}{4}
|
||
|
|
||
|
\section{Boucle \lstinline{while}}
|
||
|
|
||
|
Quand on veut \textbf{faire} quelque chose \textbf{tant que} quelque chose reste vrai, on utilise une boucle \lstinline{while}.
|
||
|
|
||
|
\begin{multicols}{3}
|
||
|
\begin{minipage}{0.8\linewidth}
|
||
|
\begin{lstlisting}
|
||
|
n = 0
|
||
|
u = 1
|
||
|
print(u)
|
||
|
while n < 5:
|
||
|
n = n + 1
|
||
|
u = u * 2
|
||
|
print(u)\end{lstlisting}
|
||
|
\end{minipage}
|
||
|
|
||
|
\columnbreak
|
||
|
|
||
|
Tableau des variables
|
||
|
\begin{center}
|
||
|
\begin{tabular}{c|c}
|
||
|
n & u \\
|
||
|
\hline
|
||
|
& \\
|
||
|
& \\
|
||
|
& \\
|
||
|
\end{tabular}
|
||
|
\end{center}
|
||
|
\columnbreak
|
||
|
|
||
|
Le programme va afficher
|
||
|
|
||
|
|
||
|
\end{multicols}
|
||
|
|
||
|
\afaire{Prévoir ce que vont afficher ces deux programmes et compléter le tableau des variables}
|
||
|
|
||
|
\end{document}
|