Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package p03_Arrays.Exercices;
- import java.util.Arrays;
- import java.util.Scanner;
- public class h_MagicSum {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- int[] ints = Arrays.stream(console.nextLine().split(" "))
- .mapToInt(Integer::parseInt).toArray();
- int equalNum = Integer.parseInt(console.nextLine());
- for (int i = 0; i < ints.length; i++) {
- for (int j = i+1; j < ints.length; j++) {
- if (ints[i] + ints[j] == equalNum){
- System.out.println(ints[i] + " " + ints[j]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement