Advertisement
dabidabidesh

Magic Sum

Jun 5th, 2020
1,490
0
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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement