diff --git a/00-facile/exercice-0/exercice-0.js b/00-facile/exercice-0/exercice-0.js index 34e80c7..4156c57 100644 --- a/00-facile/exercice-0/exercice-0.js +++ b/00-facile/exercice-0/exercice-0.js @@ -1,6 +1,7 @@ function exercice0() { - + } +console.log("coucou"); // Ne touchez pas à la ligne suivante -module.exports = exercice0; \ No newline at end of file +module.exports = exercice0; diff --git a/00-facile/exercice-3/exercice-3.js b/00-facile/exercice-3/exercice-3.js index f90e7f9..db78a20 100644 --- a/00-facile/exercice-3/exercice-3.js +++ b/00-facile/exercice-3/exercice-3.js @@ -1,5 +1,17 @@ function exercice3(n) { - + let compteur = 0; + while(n!==1){ + console.log(n); + if(nombreEstPair(n)){ + n /= 2; + } + else { + n = (n * 3) + 1; + } + compteur ++; + } + console.log("Nombre d'étapes : " + compteur); + return n; } function nombreEstPair(nombre) { @@ -7,5 +19,7 @@ function nombreEstPair(nombre) { return nombre % 2 === 0; } +let nombre = 12; +let ex3 = exercice3(nombre); // Ne touchez pas à la ligne suivante -module.exports = exercice3; \ No newline at end of file +module.exports = exercice3; diff --git a/00-facile/exercice-4/exercice-4.js b/00-facile/exercice-4/exercice-4.js index 06da3b0..5dc06d3 100644 --- a/00-facile/exercice-4/exercice-4.js +++ b/00-facile/exercice-4/exercice-4.js @@ -1,6 +1,31 @@ -function exercice4(nombre) { - +function exercice4(convertTab) { + let solution = []; + for(let i = 0; i < convertTab.length; i ++){ + solution.push(nombreRomain[i]); + } + return solution; } +let nombreRomain = { + I : 1, + II : 2, + III : 3, + V : 5, + X : 10, + L : 50, + C : 100, + D : 500, + M : 1000 +}; + +let num = 15; + +let convertTab = String(num).split(""); + +let ex4 = exercice4(convertTab); + +console.log(ex4); + + // Ne touchez pas à la ligne suivante -module.exports = exercice4; \ No newline at end of file +module.exports = exercice4; diff --git a/00-facile/exercice-5/exercice-5.js b/00-facile/exercice-5/exercice-5.js index 3ef38ea..2e29cf4 100644 --- a/00-facile/exercice-5/exercice-5.js +++ b/00-facile/exercice-5/exercice-5.js @@ -1,6 +1,25 @@ function exercice5(cote1, cote2, cote3) { - + if(cote1 === 0 || cote2 === 0 || cote3 === 0){ + return "On peut pas avoir un 0 en coté"; + } + if(cote1 === cote2 && cote2 === cote3 && cote3 === cote1){ + return "équilatéral"; + } + if(cote1+cote2