Académique Documents
Professionnel Documents
Culture Documents
Programmation en C
Saisie et Affichage en
algorithmique
Pr. SALL Ousmane
Département Informatique
UFR Sciences et Technologies
Université de THIES
Algorithme AffichageNomComplet
variables Nom, Prenom, Nom_Complet : chaîne de caractères;
Début
afficher("entrez votre nom");
Lire(Nom);
afficher("entrez votre prénom");
Lire(Prenom);
Nom_Complet ← Nom &" " & Prenom;
afficher("Votre nom complet est : ", Nom_Complet);
Fin
2019-2020 Algorithmique et Programmation 51
Exercice 13:
(respect des règles)
⚫ Chacun de ces quatre algorithmes contient une erreur. Laquelle?
Algorithme Exo1 Algorithme Exo2
Variables Variables
Quantité : entier; X, Y, Z : réel;
Prix_unit : réel; Début
Début Lire(X, Y);
Lire(Quantité, Prix_unit); Y ← X-Y;
Prix_total ← Quantité * Prix_unit; afficher(Z);
afficher(Prix_total); Fin
Fin
Algorithme Exo3 Algorithme Exo4
Variables Variables
A1, A2: entier; X : réel;
A3 : réel; Début
Début Lire(X);
Lire(A1, A2); X ← X-1;
A2 ← A1 * A3; X ← Pi * X;
afficher(A2); afficher(X);
Fin Fin
2019-2020 Algorithmique et Programmation 52
Méthode de construction d’un
algorithme simple (1/4)
Exemple :
Méthodologie à suivre :
⚫ constantes : Pi = 3.14159