Algorithme
bila
-
Heliotte Messages postés 1561 Statut Membre -
Heliotte Messages postés 1561 Statut Membre -
Bonjour,
svp comment ecrire un algorithme qui saisit un nombre entier et l'affiche a l'enverse
svp comment ecrire un algorithme qui saisit un nombre entier et l'affiche a l'enverse
1 réponse
-
Bonsoir bila,
Quelque chose comme cela :Variables: Nombre, i, ENTIER; sEntier, sEntierOut, CHAINE; FONCTION MAIN() Entrée: Lire Nombre; sEntier=CHAINE(Nombre); AFFICHE("Le Nombre à l'envers est : " + RetourneChaine(sEntier)); FIN FONCTION FONCTION CHAINE RetourneChaine(CHAINE sEntier) SI(sEntier=="") ALORS RETOURNE = ""; FIN SI sEntierOut=""; POUR (i=(LONGUEUR(sEntier)-1) ; i<=0 ; i--) sEntierOut=sEntierOut + sEntier(i); FIN POUR RETOURNE sEntier; FIN FONCTION