Question: Help me fix the problem with my code. import java.util.Scanner; public class Problem1 { public static int[] makeBigger(int[] arr, int n) { int[] newArr =

 Help me fix the problem with my code. import java.util.Scanner; publicclass Problem1 { public static int[] makeBigger(int[] arr, int n) { int[]

Help me fix the problem with my code.

import java.util.Scanner;

public class Problem1 {

public static int[] makeBigger(int[] arr, int n) {

int[] newArr = new int[arr.length + n];

for (int i = 0; i

newArr[i] = arr[i];

System.out.print(newArr[i] + " ");

}

for (int j = arr.length; j

System.out.print(newArr[j] + " ");

}

return newArr;

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();

int[] arr = new int[n];

for (int i = 0; i

arr[i] = sc.nextInt();

}

int x = sc.nextInt();

int[] result = makeBigger(arr, x);

System.out.print(result);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!