Last active
October 11, 2018 17:41
-
-
Save charlesdarkwind/1375af3bbaef4c983e24e10d1d11ba73 to your computer and use it in GitHub Desktop.
Exercice pseudoCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6. Liste de doublons d'une liste non ordonee | |
Entree: monTableau: int[] | |
Sortie: void | |
Procedure: listerDoublons(monTableau) | |
DEBUT | |
POUR i = 0 a monTableau.length - 1 | |
POUR j = 0 a monTableau.length - 1 | |
SI ( i != j && monTableau[i] == monTableau[j] ) | |
afficher( monTableau[i] ); | |
FINSI | |
FINPOUR | |
FINPOUR | |
RETOURNER doublons; | |
FIN | |
7. Palindrome | |
Entree: mot: tableau | |
Sortie: estPalindrome: boolean | |
Procedure: checkerSiPalindrome(mot) | |
DEBUT | |
POUR i = 0 a mot.length - 1 | |
SI ( mot.length - (1 + i) != i && mot[i] != mot[mot.length - (1 + i)] ) | |
RETOURNER faux; | |
FINSI | |
FINPOUR | |
RETOURNER vrai; | |
FIN | |
8. X a la puissance n | |
Entres: x: entier, n: entier | |
Sortie: y: entier | |
Procedure: calculerPuissance(x, n) | |
DEBUT | |
absN = abs(n); | |
y = x; | |
SI (n == 0) | |
RETOURNER 1; | |
FINSI | |
POUR i = 1 a absN | |
y * x; | |
FINPOUR | |
SI (n > 0) | |
RETOURNER y; | |
SINON | |
RETOURNER 1 / y; | |
FINSI | |
FIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment