iiddaannyy

Untitled

Feb 18th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2.  
  3. public class Test
  4. {
  5.     public static void Main()
  6.     {
  7.         int?[] arr = new int?[10] { 1, 1, 2, 3, 2, 1, 10, 10, 4, 3 };
  8.         for (int i = 0; i < arr.Length - 1; ++i)
  9.         {
  10.             if (arr[i] == null)
  11.             {
  12.                 continue;
  13.             }
  14.             int count = 1;
  15.             for (int j = i + 1; j < arr.Length; ++j)
  16.             {
  17.                 if (arr[i] == arr[j] && arr[j] != null)
  18.                 {
  19.                     ++count;
  20.                     arr[j] = null;
  21.                 }
  22.             }
  23.             if (count >= 2)
  24.             {
  25.                 Console.WriteLine(arr[i]);
  26.             }
  27.             arr[i] = null;
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment