Advertisement
magrega

Untitled

Jun 3rd, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SoloLearn
  8. {
  9.  
  10.  
  11. class Program
  12. {
  13.  
  14. public static int find_it(int[] seq)
  15. {
  16.  
  17. int count = 0;
  18.  
  19. for (int k = 0; k < seq.Length; k++)
  20. {
  21. for (int i = k; i < seq.Length - 1; i++)
  22. {
  23. if (seq[k] == seq[i])
  24. {
  25. count++;
  26.  
  27. }
  28. }
  29. }
  30. if (count % 2 == 0)
  31.  
  32. return count;
  33. }
  34.  
  35.  
  36. static void Main(string[] args)
  37. {
  38. int[] oddArr = { 20, 1, -1, 2, -2, 3, 3, 5, 5, 1, 2, 4, 20, 4, -1, -2, 5 };
  39. Console.WriteLine(find_it(oddArr));
  40.  
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement