Advertisement
Guest User

Untitled

a guest
May 12th, 2020
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. let input = [
  2. '2346',
  3. ];
  4.  
  5. let print = this.print || console.log;
  6. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  7.  
  8. let inputOne = +gets();
  9.  
  10. let fourthDigit = inputOne % 10;
  11. input = Math.floor(input / 10);
  12.  
  13. let thirdDigit = input % 10;
  14. input = Math.floor(input / 10);
  15.  
  16. let secondDigit = input % 10;
  17. input = Math.floor(input / 10);
  18.  
  19. let firstDigit = input % 10;
  20. input = Math.floor(input / 10);
  21.  
  22. let sum = firstDigit + secondDigit + thirdDigit + fourthDigit;
  23. console.log(sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement