dabidabidesh

Magic Sum

Jun 5th, 2020
324
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //08. Magic Sum
  2. function magicSum(arr, n) {
  3.   'use strict'
  4.  
  5.   for (let i = 0; i < arr.length; i++)
  6.     for (let j = i + 1; j < arr.length; j++)
  7.       if (arr[i] + arr[j] === n)
  8.         console.log(`${arr[i]} ${arr[j]}`)
  9. }
RAW Paste Data