View difference between Paste ID: AvR4u9nj and Atju9tRJ
SHOW: | | - or go back to the newest paste.
1
package L06ArraysExcercise;
2
3
import java.util.Arrays;
4
import java.util.Scanner;
5
6
public class P08MagicSum {
7
    public static void main(String[] args) {
8
        Scanner scan = new Scanner(System.in);
9
10
        int[] numbers = Arrays
11
                .stream(scan.nextLine().split(" "))
12
                .mapToInt(Integer::parseInt)
13
                .toArray();
14-
        String pairs = "";
14+
15
 
16
        for (int i = 0; i < numbers.length; i++) {
17
            for (int j = i+1; j < numbers.length; j++) {
18
                if (numbers[i] + numbers[j] == number){
19
                    System.out.printf("%d %d\n", numbers[i], numbers[j]);
20
                }
21
            }
22
        }
23-
        System.out.println(pairs);
23+
24
}
25