Advertisement
Guest User

A[10,10]#2222

a guest
Jan 24th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. int max = 0;
  6. int[,] array = new int[10,10];
  7. Random rand = new Random();
  8. for (int i = 0; i < array.GetLength(0); i++)
  9. {
  10. for (int j = 0; j < array.GetLength(1); j++)
  11. {
  12. array[i, j] = rand.Next(1,9);
  13. Console.Write(array[i,j] + " ");
  14. if(array[i,j]> max)
  15. {
  16. max = array[i, j];
  17. }
  18. }
  19. Console.WriteLine();
  20. }
  21. Console.WriteLine(max);
  22.  
  23. for (int i = 0; i < array.GetLength(0); i++)
  24. {
  25. for (int j = 0; j < array.GetLength(1); j++)
  26. {
  27. if (array[i, j] == max)
  28. {
  29. array[i,j] = 0;
  30. }
  31. Console.Write(array[i, j] + " ");
  32. }
  33. Console.WriteLine();
  34. }
  35.  
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement