I wrote this piece of code that makes a simple 6x6 matrix (after taking input from the user) and I have to add a code that will scan the matrix and count for palindromes (if any) and will show their exact location (for example "First palindrome is at row 6 and column 2 \n Second palindrome is at row 2 column 4... etc ) but for that I have to use a "method" and that is where things gets weird for me as I have no experience in doing so. I really hope to get some help here. Thankyou so much.
Here's my matrix code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArrayMatrix
{
class Program
{
static void Main(string[] args)
{
int i, j;
int[,] arr1 = new int[6, 6];
Console.Write("Input elements in the matrix :\n");
for (i = 0; i < 6; i++)
{
for (j = 0; j < 6; j++)
{
Console.Write("element - [{0},{1}] : ", i, j);
arr1[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.Write("\nThe matrix is : \n");
for (i = 0; i < 6; i++)
{
Console.Write("\n");
for (j = 0; j < 6; j++)
Console.Write("{0}\t", arr1[i, j]);
}
Console.Write("\n\n");
Console.ReadKey();
}
}
}