anoop kumar

anoop kumar

  • NA
  • 19
  • 2.8k

Array sorting problem

Sep 24 2018 10:33 AM
I have 3 array of int data type and i want to find common numbers from arrays without using standard method.
 
I tried this:--
 
class Program
{
static void Main(string[] args)
{
int[] array1 = { 1, 4, 2, 8, 7 };
int[] array2 = { 7, 5, 9, 1, 0,2,15};
int[] array3 = { 7, 5, 9, 1, 0, 2, 15,56,23 };
for (int i=0; i<array1.Length;i++)
{
for (int j = 0; j < array2.Length; j++)
{
for (int k = 0; k < array1.Length; k++)
{
if (array1[i] == array2[j] || array1[j] == array2[k])
{
Console.WriteLine(array1[i]);
}
}
}
}
Console.ReadKey();
}
}

Answers (1)