Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 12. Write a program that reads from the console a positive integer
- // number N (N < 20) and outputs a matrix.
- using System;
- namespace ex12
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n;
- do
- {
- Console.Write("Enter N: ");
- n = Int32.Parse(Console.ReadLine());
- } while (!(n < 20 && n > 0));
- for (int i = 0; i < n; i++)
- {
- for (int j = 1 + i; j <= n+i; j++)
- {
- Console.Write(j);
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment