Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace SymbolInMatrix
- {
- class Program
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- char[,] matrix = new char[N, N];
- for (int rows = 0; rows < N; rows++)
- {
- char[] parameters = Console.ReadLine().ToCharArray();
- for (int cols = 0; cols < N; cols++)
- {
- matrix[rows, cols] = parameters[cols];
- }
- }
- char symbol = char.Parse(Console.ReadLine());
- for (int rows = 0; rows < N; rows++)
- {
- for (int cols = 0; cols < N; cols++)
- {
- if ((matrix[rows, cols] == symbol))
- {
- Console.WriteLine("(" + rows + ", " + cols + ")");
- break;
- }
- else if (rows == N - 1 && cols == N - 1 && matrix[rows, cols] != symbol)
- {
- Console.WriteLine(symbol + " does not occur in the matrix");
- }
- else
- {
- continue;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement