Advertisement
alexey3017

Untitled

Mar 22nd, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 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. namespace Learn1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. int[,] array = new int[10, 10];
  13. Random rand = new Random();
  14. int maxValue = int.MinValue;
  15. int[,] arr = new int[10, 10];
  16.  
  17.  
  18. for (int i = 0; i < array.GetLength(0); i++)
  19. {
  20. for (int j = 0; j < array.GetLength(1); j++)
  21. {
  22. array[i, j] = rand.Next(0, 50);
  23. }
  24. }
  25. Console.WriteLine("Исходная Матрица:");
  26.  
  27. for (int i = 0; i < array.GetLength(0); i++)
  28. {
  29. for (int j = 0; j < array.GetLength(1); j++)
  30. {
  31. Console.Write(array[i, j] + " ");
  32. if (maxValue < array[i, j])
  33. {
  34. maxValue = array[i, j];
  35.  
  36. }
  37. }
  38. Console.WriteLine();
  39. }
  40. Console.WriteLine("Наибольший элемент: " + maxValue);
  41.  
  42. Console.WriteLine("Полученная матрица:");
  43. for (int i = 0; i < arr.GetLength(0); i++)
  44. {
  45. for (int j = 0; j < arr.GetLength(1); j++)
  46. {
  47. arr[i, j] = array[i, j];
  48.  
  49. Console.Write(arr[i, j] + " ");
  50. }
  51. Console.WriteLine();
  52. }
  53.  
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement