Advertisement
Spocoman

07. NxN Matrix

Jan 26th, 2022
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace NxNMatrix
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             string print = "";
  11.             Console.WriteLine(NxNMatrix(n, print));
  12.         }
  13.  
  14.         static string NxNMatrix(int n, string print)
  15.         {
  16.             for (int i = 0; i < n; i++)
  17.             {
  18.                 for (int j = 0; j < n; j++)
  19.                 {
  20.                     print += $"{n} ";
  21.                 }
  22.                 print += '\n';
  23.             }
  24.             return print;
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement