Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace methods_7
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int number = int.Parse(Console.ReadLine());
  11.  
  12. Matrix(number);
  13. }
  14.  
  15. private static void Matrix(int num)
  16. {
  17. int rows = num;
  18. int columns = num;
  19. int[,] matrix = new int[rows, columns];
  20. Enumerable.Range(0, rows).ToList().ForEach(row => Enumerable.Range(0, columns).ToList().ForEach(column =>
  21. {
  22. matrix[row, column] = 2;
  23. Console.Write(column == columns ? Environment.NewLine + matrix[row, column].ToString() + "\t" : matrix[row, column].ToString() + "\t");
  24. }));
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement