fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int[] arr1 = new int[] { 1, 2, 2, 3, 3, 4, 5 }; //массив создаем
  8.  
  9. int index1 = 0;
  10.  
  11. for (int i = 0; i < arr1.Length; i++)// здесь будет браться число, которое будет сравниваться со всеми остальными
  12. {
  13. for (int j = 0; j < arr1.Length; j++) //здесь идет сравнение как раз 1 числа с остальными
  14. {
  15. if (i != j && arr1[i] == arr1[j] )
  16. {
  17. Console.WriteLine(arr1[i]);
  18. i += 1;
  19. //break;
  20. }
  21. }
  22. }
  23. }
  24. }
Success #stdin #stdout 0.01s 131648KB
stdin
Standard input is empty
stdout
2
3