find common element in two given arrays
SOURCE : CommonArrayElement.javapublic class CommonArrayElement { public static void main(String[] args) { int[] arr1 = {4,7,3,9,2}; int[] arr2 = {3,2,12,9,40,32,4}; try { for(int i=0;i for(int j=0;j if(arr1[i]==arr2[j]){ System.out.println(arr1[i]); } } } } catch (Exception e) { // TODO: handle exception } }} INPUTint[] arr1 = {4,7,3,9,2};int[] arr2 = {3,2,12,9,40,32,4};OUTPUT4392

0 comments :
Post a Comment