0
Why is it that when I choose the range from 1 to 27, the computer sees the perfect number 6, and if it is from 1 to 30,
function perfect(min, max) { let n = 0; for (let i = 1; i < min; i++) { if (min % i == 0) { n += i; } } if (n == min) { console.log (`Your ${min} is perfect`); } else if (min != max){ min++; perfect(min, max); } } perfect(min = +prompt('Enter the minimum number of your range'), max = +prompt('Enter the maximum number of your range'))
1 Réponse
0
it does not see the perfect number 28, and also with the perfect number 498