Advertisement
NadyaMisheva

Untitled

Feb 24th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. public class Program
  5. {
  6. public static void Main()
  7. {
  8. Console.Write("Enter the number of the rows:");
  9. int rows = int.Parse(Console.ReadLine());
  10.  
  11. Console.Write("Enter the number of the columns:");
  12. int cols = int.Parse(Console.ReadLine());
  13.  
  14. int[,] mn = new int[rows, cols];
  15. Console.WriteLine("Enter the cells of the matrix:");
  16. for(int row = 0; row < rows; row++)
  17. {
  18. for(int col = 0; col < cols; col++)
  19. {
  20. Console.WriteLine("Matrix{0},{1} =", row, col);
  21. mn[row,col]= int.Parse(Console.ReadLine());
  22. }
  23. }
  24. for(int row = 0; row < mn.GetLength(0); row++)
  25. {
  26. for(int col = 0; col< mn.GetLength(1); col++)
  27. {
  28. Console.WriteLine(" " + mn[row, col]);
  29. }
  30. }
  31. Console.WriteLine();
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement