import java.util.Scanner;
public class Common_Elements
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the 10 elements for first array: ");
int A[] = new int[10];
for(int i = 0 ; i<10;i++)
A[i] = sc.nextInt();
System.out.println("Enter 15 elements for the second array: ");
int B[] = new int[15];
for(int i = 0 ; i<15;i++)
B[i] = sc.nextInt();
int C[] = new int[15];
int cnt = 0;
for(int i = 0 ; i<10;i++)
for(int j = 0 ; j<15;j++)
if(A[i] == B[j])
{
C[cnt] = A[i];
cnt++;
break;
}
System.out.println("Common Elements: ");
for(int i = 0 ; i < cnt ; i++)
System.out.println(C[i]);
}
}
public class Common_Elements
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the 10 elements for first array: ");
int A[] = new int[10];
for(int i = 0 ; i<10;i++)
A[i] = sc.nextInt();
System.out.println("Enter 15 elements for the second array: ");
int B[] = new int[15];
for(int i = 0 ; i<15;i++)
B[i] = sc.nextInt();
int C[] = new int[15];
int cnt = 0;
for(int i = 0 ; i<10;i++)
for(int j = 0 ; j<15;j++)
if(A[i] == B[j])
{
C[cnt] = A[i];
cnt++;
break;
}
System.out.println("Common Elements: ");
for(int i = 0 ; i < cnt ; i++)
System.out.println(C[i]);
}
}