Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Test
- {
- public static void Main()
- {
- int?[] arr = new int?[10] { 1, 1, 2, 3, 2, 1, 10, 10, 4, 3 };
- for (int i = 0; i < arr.Length - 1; ++i)
- {
- if (arr[i] == null)
- {
- continue;
- }
- int count = 1;
- for (int j = i + 1; j < arr.Length; ++j)
- {
- if (arr[i] == arr[j] && arr[j] != null)
- {
- ++count;
- arr[j] = null;
- }
- }
- if (count >= 2)
- {
- Console.WriteLine(arr[i]);
- }
- arr[i] = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment