diff --git a/scripts/fonctions_principales.js b/scripts/fonctions_principales.js index 91bc3f8..4652894 100644 --- a/scripts/fonctions_principales.js +++ b/scripts/fonctions_principales.js @@ -333,19 +333,19 @@ function convertRomanToArabic(str) { // VĂ©rifie si un nombre fait partie des nombres d'Armstrong ou non function armstrongNumber(number) { - let nombreString = number.toString(); - let nombreStringLength = nombreString.length; + let numberString = number.toString(); + let numberStringLength = numberString.length; let result = 0; let resultString = ""; - for (let i = 0; i < nombreStringLength; i++) { - result = result + parseInt(nombreString[i])**nombreStringLength; - resultString = resultString + " + " + nombreString[i] + "" + nombreStringLength + ""; + for (let i = 0; i < numberStringLength; i++) { + result = result + parseInt(numberString[i])**numberStringLength; + resultString = resultString + " + " + numberString[i] + "" + numberStringLength + ""; } - if (result === nombre) { - return `${formatNumberResult(nombre)} est un nombre d'Armstrong, car ${resultString.slice(2)} = ${formatNumberResult(result)}.`; + if (result === number) { + return `${formatNumberResult(number)} est un nombre d'Armstrong, car ${resultString.slice(2)} = ${formatNumberResult(result)}.`; } else { - return `${formatNumberResult(nombre)} n'est pas un nombre d'Armstrong, car ${resultString.slice(2)} = ${formatNumberResult(result)}.`; + return `${formatNumberResult(number)} n'est pas un nombre d'Armstrong, car ${resultString.slice(2)} = ${formatNumberResult(result)}.`; } } \ No newline at end of file