Advertisement
Cataykus

Untitled

Mar 27th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 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 dz1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[,] array =
  14. {
  15. { 2, 1, 2, 3, 4, 5, 6, 7, 8, 4, },
  16. { 1, 1, 2, 3, 4, 5, 6, 7, 8, 1, },
  17. { 5, 1, 2, 3, 4, 5, 6, 7, 8, 3, },
  18. { 6, 1, 2, 3, 4, 5, 6, 7, 8, 1, },
  19. { 3, 1, 2, 3, 4, 5, 6, 7, 8, 2, },
  20. { 3, 1, 2, 3, 4, 5, 6, 7, 8, 5, },
  21. { 4, 1, 2, 3, 4, 5, 6, 7, 8, 6, },
  22. { 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, },
  23. { 6, 1, 2, 3, 4, 5, 6, 7, 8, 5, },
  24. { 1, 1, 2, 3, 4, 5, 6, 7, 8, 4, },
  25. };
  26.  
  27. int maxValue = int.MinValue;
  28.  
  29. for (int i = 0; i < array.GetLength(0); i++)
  30. {
  31. for (int j = 0; j < array.GetLength(1); j++)
  32. {
  33. if (maxValue < array[i, j]) maxValue = array[i, j];
  34.  
  35. Console.Write($"{array[i, j]} ");
  36. }
  37. Console.WriteLine();
  38. }
  39.  
  40. Console.WriteLine("\n\n\n");
  41.  
  42. for (int i = 0; i < array.GetLength(0); i++)
  43. {
  44. for (int j = 0; j < array.GetLength(1); j++)
  45. {
  46. if (array[i, j] == maxValue) array[i, j] = 0;
  47.  
  48. Console.Write($"{array[i, j]} ");
  49. }
  50. Console.WriteLine();
  51. }
  52.  
  53. Console.WriteLine($"\n{maxValue} Наибольший элемент");
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement