Advertisement
CR7CR7

balanced numbers

Aug 21st, 2022
897
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.24 KB | Source Code | 0 0
  1. let print = this.print || console.log;
  2. let output = 0
  3. for(i = 1 ; i <= 1000 ; i++){
  4. let number = +gets()
  5. let m = number.toString()
  6. let n = m.split("").map(Number)
  7. if(n[0] + n[2] === n[1]){
  8.   output += number
  9. }
  10. else {break;}
  11. }
  12. print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement