//Why is code doesn't works?// | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

//Why is code doesn't works?//

function perfect(number) { for (let i = 1; i < number; i++) { if (number % i == 0) { var n = 0; console.log (n += i); } } if (n == number) { console.log ('Your number is perfect'); } else { console.log ('Your number is unperfect'); } } perfect(num = +prompt('Enter the number, and the computer will check if it is perfect'))

24th Apr 2021, 11:08 AM
Тимур Завьялов
Тимур Завьялов - avatar
1 Answer
0
Nikhil, thank you :)
25th Apr 2021, 5:46 AM
Тимур Завьялов
Тимур Завьялов - avatar