Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(num) {
- let sum = 0;
- for (let i = 1; i < num; i++) {
- if (num % i === 0) {
- sum += i;
- }
- }
- if (sum === num) {
- console.log("We have a perfect number!");
- } else {
- console.log(`It's not so perfect.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement