Guest User

Untitled

a guest
Apr 3rd, 2020
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _4._symbol_in_matrix
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. char[,] matrix = new char[n, n];
  11. for (int i = 0; i < n; i++)
  12. {
  13. string input = Console.ReadLine();
  14.  
  15. for (int j = 0; j < input.Length; j++)
  16. {
  17. matrix[i, j] = input[j];
  18. }
  19. }
  20. char findSymbol = char.Parse(Console.ReadLine());
  21. bool isFind = false;
  22. for (int i = 0; i < n; i++)
  23. {
  24. for (int j = 0; j < n; j++)
  25. {
  26. if ( matrix[i,j] == findSymbol )
  27. {
  28. Console.WriteLine($"({i}, {j})");
  29. isFind = true;
  30. break;
  31. }
  32. }
  33. }
  34. if (!isFind)
  35. {
  36. Console.WriteLine($"{findSymbol} does not occur in the matrix");
  37. }
  38. }
  39. }
  40. }
Add Comment
Please, Sign In to add comment