Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Symbol_in_Matrix
- {
- class SymbolinMatrix
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- char[,] arr = new char[n, n];
- for (int i = 0; i < n; i++)
- {
- char[] tempArr = Console.ReadLine().ToCharArray();
- for (int j = 0; j < n; j++)
- {
- arr[i, j] = tempArr[j];
- }
- }
- char sh = char.Parse(Console.ReadLine());
- bool isFind = false;
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int j = 0; j < arr.GetLength(1); j++)
- {
- if ((arr[i, j].Equals(sh)) && (!isFind))
- {
- Console.WriteLine($"({i}, {j})");
- isFind = true;
- }
- }
- }
- if (!isFind)
- {
- Console.WriteLine($"{sh} does not occur in the matrix");
- }
- }
- }
- }
Advertisement
RAW Paste Data
Copied
Advertisement