Advertisement
Guest User

Ivan

a guest
Jan 19th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 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 array10x10
  8. {
  9. class Program
  10. {
  11.  
  12. static void Main(string[] args)
  13. {
  14. int maxValue = int.MinValue;
  15. int saveX = 0;
  16. int saveY = 0;
  17. int[,] array = {
  18. {1,2,3,4,5,355,2,5,7,4},
  19. {5,5,8,3,4,3,5,6,4,3},
  20. {9,553,7,4,4,2,5,6,3,5},
  21. {3,5,5,4,8,9,4,665,7,4},
  22. {4,6,8,445,7,5,6,3,6,4},
  23. {4,6,7,4,6,7,6,6,4,6},
  24. {6,5,3,5,3,5,3,6,3,1},
  25. {6,5,5,5,3,5,3,6,3,1},
  26. {5,5,8,3,4,3,5,6,555,3},
  27. {3,5,5,6,8,5,999,6,8,9} };
  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 (array[i, j] > maxValue)
  34. {
  35. maxValue = array[i, j];
  36. saveX = i;
  37. saveY = j;
  38. }
  39. }
  40. }
  41. array[saveX, saveY] = 0;
  42. for (int i = 0; i != array.GetLength(0); i++)
  43. {
  44. for (int j = 0; j != array.GetLength(1); j++)
  45. {
  46.  
  47. Console.Write(array[i, j]);
  48.  
  49. }
  50. Console.WriteLine();
  51. }
  52. Console.SetCursorPosition(0, 12);
  53. Console.WriteLine(maxValue);
  54. }
  55.  
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement