Advertisement
Guest User

Algorytmy

a guest
Oct 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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 ConsoleApp18
  8. {
  9. class Zadanie2
  10. {
  11. public static void Main()
  12. {
  13. /* 2 */
  14. int[] gg = new int[20];
  15. Random random = new Random();
  16.  
  17. for (int i=0; i<20; i++)
  18. {
  19. var arr = Enumerable.Range(5, 30).Select(n => random.Next(5, 30)).ToArray();
  20. Console.WriteLine(String.Join(" ", gg));
  21. Console.ReadKey();
  22. }
  23. }
  24. }
  25. class Program
  26. {
  27. static void Main(string[] args)
  28. { /* 1 */
  29. Random rnd = new Random();
  30. int[] arr = new int[6];
  31. for(int i=0; i<6; i++)
  32. {
  33. arr[i] = rnd.Next(1, 49);
  34. Console.WriteLine(String.Join(" ", arr));
  35. var val = arr.GroupBy(x => x).OrderByDescending(x => x.Count()).First().Key;
  36. Console.ReadKey();
  37. }
  38.  
  39. }
  40.  
  41.  
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement