//Initialize array
int[] arr = new int[] {1,5,7,3,4, 9, 11, 15, 17, 1, 2, 3, 4, 2, 7, 8, 8, 3 };
Console.WriteLine("Duplicate elements in given array: ");
//Searches for duplicate element
for (int i = 0; i < arr.Length; i++)
{
for (int j = i + 1; j < arr.Length; j++)
{
if (arr[i] == arr[j])
{
Console.WriteLine("Array of i "+ arr[i]);
Console.WriteLine("Array of J "+arr[j]);
}
}
}
No comments:
Post a Comment