Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- '2346',
- ];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let inputOne = +gets();
- let fourthDigit = inputOne % 10;
- input = Math.floor(input / 10);
- let thirdDigit = input % 10;
- input = Math.floor(input / 10);
- let secondDigit = input % 10;
- input = Math.floor(input / 10);
- let firstDigit = input % 10;
- input = Math.floor(input / 10);
- let sum = firstDigit + secondDigit + thirdDigit + fourthDigit;
- console.log(sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement