Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Campus {
- static int[] a;
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int valor;
- System.out.println("escribe 5 elementos");
- a = new int[5];
- for (int i = 0; i < a.length; i++) {
- a[i] = in.nextInt();
- }
- System.out.println("ingrese valor resultado de suma");
- valor = in.nextInt();
- for (int i = 0; i < a.length; i++) {
- for (int j = 0; j < a.length; j++) {
- if (i != j && a[i] + a[j] == valor) {
- System.out.println("Se encontrĂ³: " + a[i] + " y " + a[j]);
- System.exit(0);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement