package com.javaproficiency;
public class CommonElementOfTwoArray {
public static void main(String[] args) {
int []arr = {10,15,20,25,40};
int []brr ={5,18,20,25,30,10};
for( int i=0 ; i < arr.length ; i++ ){
for( int j=0 ; j < brr.length ; j++ ){
if(arr[i] == brr[j])
System.out.println(arr[i]);
}
}
}
}
public class CommonElementOfTwoArray {
public static void main(String[] args) {
int []arr = {10,15,20,25,40};
int []brr ={5,18,20,25,30,10};
for( int i=0 ; i < arr.length ; i++ ){
for( int j=0 ; j < brr.length ; j++ ){
if(arr[i] == brr[j])
System.out.println(arr[i]);
}
}
}
}
Output:
10
20
25
No comments:
Post a Comment