Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function magicSum(arr, num) {
- for (let i = 0; i < arr.length; i++) {
- let currentNum = arr[i];
- for (let j = i + 1; j < arr.length; j++) {
- let nextNum = arr[j];
- if (currentNum + nextNum === num) {
- console.log(currentNum + ' ' + nextNum);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment