From b22410fb3b4806f76aadaa246c66c31a1f19d0c9 Mon Sep 17 00:00:00 2001 From: MaxJrs Date: Thu, 16 Sep 2021 21:25:50 +0200 Subject: [PATCH] Test --- 00-facile/exercice-0/exercice-0.js | 5 ++-- 00-facile/exercice-3/exercice-3.js | 18 ++++++++++++-- 00-facile/exercice-4/exercice-4.js | 31 +++++++++++++++++++++--- 00-facile/exercice-5/exercice-5.js | 23 ++++++++++++++++-- 00-facile/exercice-6/exercice-6.js | 21 +++++++++++++++- 01-moyen/exercice-0/exercice-0.js | 19 +++++++++++++-- 01-moyen/exercice-1/exercice-1.js | 18 ++++++++++++-- 01-moyen/exercice-2/exercice-2.js | 12 +++++++-- 01-moyen/exercice-3/enonce-exercice-3.md | 2 +- 01-moyen/exercice-3/exercice-3.js | 20 +++++++++++++-- 10 files changed, 150 insertions(+), 19 deletions(-) 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