Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function specialNumbers(n) {
- let output = '';
- for (let i = 1; i <= n; i++) {
- let numAsStr = i.toString();
- let sum = 0;
- for (let j = 0; j < numAsStr.length; j++) {
- let digit = Number(numAsStr[j]);
- sum += digit;
- output = sum === 5 || sum === 7 || sum === 11? i + ' -> ' + 'True' : i + ' -> ' + 'False';
- }
- console.log(output)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment