0

lent me a hint for this problem please? (Java)

Write a Java program to find the two elements from a given array of positive and negative numbers such that their sum is closest to zero.

18th Jun 2019, 10:31 AM
Tzion
Tzion - avatar
3 ответов
0
~ swim ~ hmm,i only know using double forloop to find the sum ,but dont know how to add 1,-1
18th Jun 2019, 10:36 PM
Tzion
Tzion - avatar
0
> "how to add 1,-1" arr[1,-1,2,-3] sum = arr[0] + arr[1] ; //1 + (-1)
19th Jun 2019, 6:29 AM
zemiak