I have an exercise and find out what went wrong. I will be grateful for help :)

Write the code that will have two arrays of type int and the return array greater (if one of the two arrays is greater) and the sum of the elements in same positions with the array.

```
public class TwoArrays {
    public static void main(String[] args) {
        int[] arrayA = {1, 5, 2, 6, 8};
        int[] arrayB = {4, 5, 7, 10, 7, 9, 7};
        int lengthA = arrayA.length;
        int lengthB = arrayB.length;
        int i=0;
        if (lengthA < lengthB) {
            for (arrayB[i] = 0; i < lengthB; i++) {
                arrayB[i] = arrayA[i] + arrayB[i];
                System.out.println(arrayB[i]);
            }

        } else if (lengthA > lengthB) {
            for (arrayA[i] = 0; i < lengthA; i++) {
                arrayA[i] = arrayA[i] + arrayB[i];
                System.out.println(arrayA[i]);
            }

        } else {
            for (arrayB[i] = 0; i < lengthB; i++) {
                arrayB[i] = arrayA[i] + arrayB[i];
                System.out.println(arrayB[i]);
            }
        }
    }
}

```