Advertisement
Spocoman

08. Magic Sum

Jan 22nd, 2022 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(arr, num) {
  2.     for(let i = 0; i < arr.length; i++) {
  3.         for(let j = i + 1; j < arr.length; j++) {
  4.             if (arr[i] + arr[j] === num) {
  5.                 console.log(`${arr[i]} ${arr[j]}`);
  6.             }
  7.         }
  8.     }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement