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;
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started