Advertisement
Guest User

Untitled

a guest
Dec 4th, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. int n;
  2. do
  3. {
  4. n = Convert.ToInt32(Console.ReadLine());
  5. } while (n <= 10);
  6. int[] array = new int[n];
  7. for (int i = 0; i < n; i++)
  8. array[i] = Convert.ToInt32(Console.ReadLine());
  9. var query = array.GroupBy(item => item).OrderByDescending(g => g.Count()).Select(g => g.Key).First();
  10.  
  11.  
  12. Console.WriteLine(query);
  13. Console.ReadLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement