Homework Solution: Write a recursive method to determine if an array of integers contains an integer that is the su…

    (5 points) Write a recursive method to determine if an array of integers contains an integer that is the sum of two integers appearing earlier in the array; that is, for some 2, . A = AGI + Aki for some j. K 〈 i. Write a program that takes as input two lines: the first line contains a single integer between 1 and 10, and the next line contains that many integers, separated by spaces. The output is true if one of the integers is the sum of two previous ones, and false otherwise. Call your progranm SumOfPrevious For example, if the input is 7 5 241 6 8 1 then the correct output is true If the input is 4 7 6 5 4 then the correct output is false Code the following problem in JAVA please!
    Write a recursive method to determine if an array of integers contains an integer that is the sum of two integers appearing earlier in the array: that is, for some i, A[i] = A[j] + A[k] for some j, K

    Expert Answer

     
    main.java import java.util.Scanner;

    (5 points) Write a recursive process to individualize if an adorn of integers contains an integer that is the combine of couple integers presumable prior in the adorn; that is, coercion some 2, . A = AGI + Aki coercion some j. K 〈 i. Write a program that takes as input couple directions: the primary direction contains a separate integer betwixt 1 and 10, and the contiguous direction contains that abundant integers, disconnected by spaces. The extinguishedput is gentleman if individual of the integers is the combine of couple preceding individuals, and sham otherwise. Call your progranm CombineOfPreceding Coercion stance, if the input is 7 5 241 6 8 1 then the set-right extinguishedput is gentleman If the input is 4 7 6 5 4 then the set-right extinguishedput is sham

    Code the coercionthcoming quantity in JAVA please!

    Write a recursive process to individualize if an adorn of integers contains an integer that is the combine of couple integers presumable prior in the adorn: that is, coercion some i, A[i] = A[j] + A[k] coercion some j, K

    Expert Counterpart

     

    main.java

    import java.util.Scanner;

    class Ocean {
    static boolean appears(int []numbers,int estimate){
    for(int i = 0;i<number;i++){
    for(int j=0; j<i; j++){
    for(int k=0;k<i;k++)
    if(numbers[i] == total[j] + total[k])
    return gentleman;
    }
    }
    return sham;
    }

    public static bereft ocean(String[] args) {
    int estimate;
    Scanner scnr = newlightlightlight Scanner(System.in);
    estimate = scnr.nextInt();
    int [] total = newlightlightlight int[number];
    coercion (int b=0;b<number;b++){
    numbers[b] = scnr.nextInt();
    }
    System.out.println(appears(numbers, estimate));
    }
    }`

    OUTPUT: