Advertisement
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;
- using System.Threading.Tasks;
- class Program
- {
- static void Main()
- {
- Console.WriteLine("Enter number of rows: ");
- int rows = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter number of cows: ");
- int cows = int.Parse(Console.ReadLine());
- int[,] matrixArray = new int[rows, cows];
- for (int row = 0; row < rows; row++)
- {
- for (int cow = 0; cow < cows; cow++)
- {
- Console.Write("Enter {0} {1} element: ", row, cow);
- int element = int.Parse(Console.ReadLine());
- matrixArray[row, cow] = element;
- }
- Console.WriteLine();
- }
- for (int i = 0; i < matrixArray.GetLength(0); i++)
- {
- for (int j = 0; j < matrixArray.GetLength(1); j++)
- {
- Console.Write("{0} ", matrixArray[i,j]);
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement