Skip to content

Instantly share code, notes, and snippets.

Created December 10, 2015 21:17
Show Gist options
  • Save anonymous/131dbaab752c19d1f861 to your computer and use it in GitHub Desktop.
Save anonymous/131dbaab752c19d1f861 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class LineInventer
{
static void Main()
{
int matrixSize = int.Parse(Console.ReadLine());
int rows = matrixSize;
int cols = matrixSize;
int forCounter = 0;
char[,] matrix = new char[rows, cols];
string input;
input = Console.ReadLine();
for (int i = 0; i < matrix.GetLength(0); i++)
{
for (int j = 0; j < matrix.GetLength(1); j++)
{
matrix[i, j] = input[j];
forCounter++;
}
if (forCounter == matrixSize * matrixSize)
{
break;
}
else input = Console.ReadLine();
}
foreach (var counter in matrix)
{
Console.WriteLine(counter);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment