Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- Console.Write("Enter the number of the rows:");
- int rows = int.Parse(Console.ReadLine());
- Console.Write("Enter the number of the columns:");
- int cols = int.Parse(Console.ReadLine());
- int[,] mn = new int[rows, cols];
- Console.WriteLine("Enter the cells of the matrix:");
- for(int row = 0; row < rows; row++)
- {
- for(int col = 0; col < cols; col++)
- {
- Console.WriteLine("Matrix{0},{1} =", row, col);
- mn[row,col]= int.Parse(Console.ReadLine());
- }
- }
- for(int row = 0; row < mn.GetLength(0); row++)
- {
- for(int col = 0; col< mn.GetLength(1); col++)
- {
- Console.WriteLine(" " + mn[row, col]);
- }
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement