Advertisement
Atanasov_88

Untitled

Sep 25th, 2015
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class Program
  8. {
  9.     static void Main()
  10.     {
  11.         Console.WriteLine("Enter number of rows: ");
  12.         int rows = int.Parse(Console.ReadLine());
  13.         Console.WriteLine("Enter number of cows: ");
  14.         int cows = int.Parse(Console.ReadLine());
  15.  
  16.         int[,] matrixArray = new int[rows, cows];
  17.  
  18.  
  19.         for (int row = 0; row < rows; row++)
  20.         {
  21.             for (int cow = 0; cow < cows; cow++)
  22.             {
  23.                 Console.Write("Enter {0} {1} element: ", row, cow);
  24.                 int element = int.Parse(Console.ReadLine());
  25.                 matrixArray[row, cow] = element;
  26.             }
  27.             Console.WriteLine();
  28.         }
  29.  
  30.         for (int i = 0; i < matrixArray.GetLength(0); i++)
  31.         {
  32.             for (int j = 0; j < matrixArray.GetLength(1); j++)
  33.             {
  34.                Console.Write("{0} ", matrixArray[i,j]);
  35.             }
  36.             Console.WriteLine();
  37.         }
  38.         Console.WriteLine();
  39.     }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement