public static void Main()
var data = new [] {"A", "B", "C", "D", "E",
const int elementsPerRow = 5;
var aIndex = GetIndex(0, 0, elementsPerRow);
var eIndex = GetIndex(0, 4, elementsPerRow);
var pIndex = GetIndex(3, 0, elementsPerRow);
var tIndex = GetIndex(3, 4, elementsPerRow);
Console.WriteLine(data[aIndex]);
Console.WriteLine(data[eIndex]);
Console.WriteLine(data[pIndex]);
Console.WriteLine(data[tIndex]);
public static int GetIndex(int rowIndex, int columnIndex, int elementsPerRow) {
var index = rowIndex * elementsPerRow + columnIndex;