Advertisement
PolinaKoleva

Matrix

Dec 12th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. /* Write a program that reads from the console
  3.  * a positive integer number N (N < 20) and outputs a matrix
  4.  */
  5. class Matrix
  6. {
  7.     static void Main()
  8.     {
  9.         Console.WriteLine("Enter how big matrix want: ");
  10.         int n = int.Parse(Console.ReadLine());
  11.         int count = 1;
  12.            
  13.         for (int i = 1; i <= n ; i++)
  14.         {
  15.                 for (int j = count; j < n + count; j++)
  16.             {
  17.                 Console.Write("{0,3}",j);
  18.  
  19.             }
  20.                 Console.WriteLine();
  21.                 count++;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement