Advertisement
saimun1

Summary of numbers in table

Jul 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace test
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int n = int.Parse(Console.ReadLine());
  15.             int num = 0;
  16.             for (int row = 0; row < n; row++)
  17.             {
  18.                 for (int col = 0; col < n; col++)
  19.                 {
  20.                     num = col + row + 1 ;
  21.                     if (num > n)
  22.                         num = 2 * n - num;
  23.                     Console.Write(num + " ");
  24.                 }
  25.                 Console.WriteLine();
  26.             }
  27.  
  28.  
  29.  
  30.  
  31.             Console.ReadLine();
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement