Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Insert(int[,] arr)
- {
- for (int i = 0; i < arr.GetLength(0); i++)
- {
- for (int j = 0; j < arr.GetLength(1); j++)
- {
- Console.WriteLine("Enter a num for position " + i + " / " + j);
- arr[i, j] = int.Parse(Console.ReadLine());
- }
- }
- }
- static bool Check(int[,] arr)
- {
- bool ok = true;
- for (int i = 0; i < arr.GetLength(0) / 2; i++)
- {
- for (int j = 0; j < arr.GetLength(1) / 2; j++)
- {
- if ((arr[i, j] != arr[arr.GetLength(0) - i - 1, j]) || (arr[i, j] != arr[i, arr.GetLength(1) - j - 1]) || (arr[i, j] != arr[arr.GetLength(0) - i - 1, arr.GetLength(1) - j - 1]))
- {
- ok = false;
- }
- }
- }
- return ok;
- }
- static void Main(string[] args)
- {
- int[,] Arr = new int[4, 4];
- Insert(Arr);
- bool ok = Check(Arr);
- Console.Clear();
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- Console.Write(Arr[i, j] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine(ok);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment