Advertisement
Schnuk

686

Jan 17th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace ExamTasks
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             int n = int.Parse(Console.ReadLine());
  12.             int[,] matrix = new int[n, n];
  13.             for (int i = 0; i < n; i++)
  14.                 for (int j = 0; j < n; j++)
  15.                 {
  16.                     matrix[i, j]++;
  17.                     if (j >= n / 2)
  18.                         matrix[i, j]++;
  19.                     if (i >= n / 2)
  20.                         matrix[i, j] += 2;
  21.                 }
  22.             for (int i = 0; i < n; i++)
  23.             {
  24.                 for (int j = 0; j < n; j++)
  25.                     Console.Write(matrix[i, j] + "\t");
  26.                 Console.WriteLine("");
  27.             }
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement