Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- Console.WriteLine("Enter rows: ");
- int rows= int.Parse(Console.ReadLine());
- Console.WriteLine("Enter colums: ");
- int cols= int.Parse(Console.ReadLine());
- int[,] matrix= 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.Write("matrix[{0}, {1}] = ", row,col);
- matrix[row,col] = int.Parse(Console.ReadLine());
- }
- }
- for(int row = 0 ; row< matrix.GetLength(1); row++)
- {
- for(int col = 0 ; col< matrix.GetLength(1); col++)
- {
- Console.Write(" " + matrix[row,col]);
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement