Computer Science, asked by Sd12365, 7 months ago

Write a program in java to accept 8 numbers and 12 numbers in two separate Single Dimension Array then merge all these elements in first array to new array. please solve these program,......... don't spam.......

Answers

Answered by samarthkrv
0

Answer:

import java.util.Arrays;

public class Main

{

public static void main(String[] args) {

    java.util.Scanner s = new java.util.Scanner(System.in);

 int[] arr1 = new int[12];

 int[] arr2 = new int[8];

     for(int i = 0; i < arr1.length; i++)

         {

            System.out.print("Enter number " + (i+1) + " in aray 1:");

            int x = s.nextInt();

            arr1[i] = x;

         }

     for(int i = 0; i < arr2.length; i++)

         {

             System.out.print("Enter number " + (i+1) + "in aray 2:");

             int y = s.nextInt();

             arr2[i] = y;

         }

     System.out.println("Combined array is "+ Arrays.toString(arr1) + Arrays.toString(arr2));

}

}

Explanation:

Similar questions