summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/frpseudocode/frpseudocode-example.tex
blob: 09e8a8c9fbdc6e2c409e06adfe30265631c77abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
\documentclass[a4paper]{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{frpseudocode}
\begin{document}
\begin{algorithm}
\caption{Algorithme d'Euclide}
\begin{algorithmic}[1]
\Function{Euclide}{$a, b$}
\Comment{PGCD de a et b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{Si r = 0, on a la réponse}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile
\State \Return $b$\Comment{Le PGCD est b}
\EndFunction
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption{Démonstration boucle pour}
\begin{algorithmic}[1]
\Procedure{AfficheurMultiple}{$str$}
\Comment{Démo boucle pour}
\State $r\gets a\bmod b$
\For{$i < 15$}
\State Afficher $str$ \Comment{On affiche la chaîne}
\EndFor
\EndProcedure
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption{Démonstration boucle pour - 2}
\begin{algorithmic}[1]
\Procedure{AfficheurMultiple}{$str$}
\Comment{Démo boucle pour}
\State $r\gets a\bmod b$
\ForFT{$i$}{$0$}{$15$}
\State Afficher $str$ \Comment{On affiche la chaîne}
\EndFor
\EndProcedure
\end{algorithmic}
\end{algorithm}

\end{document}