"'O
0
c
:J
0
LI)
.--t
0
N
@
.......
J::
Ol
·;::::
>0..
0
u
Chapitre 9 • Concepts fondamentaux
210
Exercices corrigés
m Que vaut la variable c après exécution de l'algorithme suivant?
Variables : a, b, c (chaînes)
Début
a +--- 'az'
b +--- 'er'
c +--- a+b+'ty'
Fin
m Que vaut la variable al après exécution de l'algorithme suivant ?
Variables : al (réel), a2, a3 (entiers)
Début
al +- 0.l
a2 +--- 5
a3 +--- l OO
al +--- al +a2/a3
Fin
m Que Valent les Variables X et n après exécution de l' algorithme suivant ?
Variables : x (liste), n (entier)
Début
X +--- (l ,2)
Ajouter 3 à x
n +--- x [O]+x [l ]+x[2]
Fin
BJ Expliquer le rôle de l' algorithme suivant puis écrire son en-tête :
Variables : a,b,c (réels)
Début
Afficher "Saisir un nombre a :"
Saisir a
Afficher "Saisir un nombre b :"
Saisir b
c +---a
a+--- b
b +--- c
Afficher "a= ",a," ; b=", b
Fin
m Écrire un algorithme demandant à l'utilisateur un nombre entier de trois
chiffres, puis affichant la somme des chiffres de ce nombre. Implémenter cet algorithme en Python.
Précédent

- 218/302

Suivant