Create a program that takes two inputs, an int array of numbers and a sum. The program should output the unique pairs of numbers in the array that equal the sum.
let A = [ 1,2,3,4,5,6,7,8];
let n =3 ;
print(A, n);
function print(array, sum)
{
let n = new Set();
for (let i = 0; i < array.length; ++i)
{
let p = sum - array[i];
if (n.has(p)) {
document.write(
"("+ array[i]
+ ", " + p + ")");
}
n.add(array[i]);
}
}
I have created this solution but I do not know how to take user input in this, please help me for this problem solution.