public static void Main()
int[] input7 = { 1, 2, 3, 4, 5 };
int[] input8 = { 1, 5, 7, 8, 4 };
int[] result7 = IntersectionArray( input7, input8);
foreach(var c in result7)
public static int[] IntersectionArray(int[] input, int[] input1)
for(int i = 0; i < input.Length; i++)
for(int j = 0; j < input1.Length; j++)
if (input[i] == input1[j])
int[] result = new int[count];
for(int i = 0; i < input.Length; i++)
for (int j = 0; j < input1.Length; j++)
if (input[i] == input1[j])
result[count++] = input[i];