Advertisement
Guest User

Untitled

a guest
Jun 29th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace SymbolInMatrix
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int N = int.Parse(Console.ReadLine());
  12.  
  13. char[,] matrix = new char[N, N];
  14.  
  15. for (int rows = 0; rows < N; rows++)
  16. {
  17. char[] parameters = Console.ReadLine().ToCharArray();
  18.  
  19. for (int cols = 0; cols < N; cols++)
  20. {
  21.  
  22. matrix[rows, cols] = parameters[cols];
  23.  
  24.  
  25. }
  26. }
  27. char symbol = char.Parse(Console.ReadLine());
  28.  
  29. for (int rows = 0; rows < N; rows++)
  30. {
  31. for (int cols = 0; cols < N; cols++)
  32. {
  33. if ((matrix[rows, cols] == symbol))
  34. {
  35. Console.WriteLine("(" + rows + ", " + cols + ")");
  36. break;
  37. }
  38. else if (rows == N - 1 && cols == N - 1 && matrix[rows, cols] != symbol)
  39. {
  40. Console.WriteLine(symbol + " does not occur in the matrix");
  41.  
  42. }
  43.  
  44. else
  45. {
  46. continue;
  47. }
  48.  
  49.  
  50. }
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement