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;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter the number of the rows: ");
- int rows = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter the number of the columns: ");
- int cols = int.Parse(Console.ReadLine());
- int[,] matrix = new int[rows, cols];
- Console.WriteLine("Enter the cells: ");
- for (int row = 0; row < rows; row++)
- {
- for (int col = 0; col < cols; col++)
- {
- matrix[row, col] = int.Parse(Console.ReadLine());
- }
- }
- for (int i = 0; i < matrix.GetLength(0); i++)
- {
- for (int j = 0; j < matrix.GetLength(1); j++)
- {
- Console.Write(matrix[i, j]);
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment