Advertisement
3vo

Problem 1. Sum of 3 Numbers

3vo
Oct 25th, 2022 (edited)
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input = [
  2.     '3',  // the input is always a string, so it's '3' and not 3
  3.     '4',
  4.     '11'
  5. ];
  6. let print = this.print || console.log;
  7. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  8.  
  9. let n1 = Number(gets());
  10. let n2 = Number(gets());
  11. let n3 = Number(gets());
  12.  
  13. let sum = n1 + n2 + n3;
  14. print(sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement