Page 521 - Cs_withBlue_J_C11_Flipbook
P. 521
110 for(int i=0;i<size;i++)
111 {
112 ar2[i]=sc.nextInt();
113 }
114 mergesort ob=new mergesort();
115 int a[]=add(ar1,ar2,size);
116 ob.sort(a,0,a.length-1);
117 System.out.println("The sorted array");
118 printArray(a);
119 }
120 }
The output of the preceding program is as follows:
enter the size of the array
5
enter elements in the 1st array
6 3 4 7 6
enter elements in the 2nd array
2 4 3 5 6
the sum of the 2 arrays is:
8 7 7 12 12
The sorted array
7 7 8 12 12
Variable Description
NAME TYPE DESCRIPTION
arr int To store the array
size int To store the size of the array
i int Loop Variable
ar3[] int[] Sum of the arrays a[] and b[]
n int Length of the array
m int Finds the mid elements
519
Internal Assessment 519

