Exercices - WOA - Intro JS
stardisblue
15.6K views
Manipulation de nombres
Considérons l’algorithme suivant :
Soit un entier naturel A.
Tant que A est différent de 1, exécuter les instructions suivantes :
Si A est impair, alors remplacer A par 3 x A + 1
Sinon remplacer A par A/2
Ajouter A dans un tableau
Retourner le tableau de A
Écrire l'algorithme.
1
2
3
4
5
6
7
8
9
10
function manipulationDeNombre(a) {
return a;
}
// {
module.exports = {
manipulationDeNombre: manipulationDeNombre
};
// }
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.