In this program I have written a code to print pattern.

Example

1
2 5
3 6 8
4 7 9 10

Program

using System;

namespace pattern1

{

class Program

{

static void Main(String[] args)

{

int n, k, no;

Console.WriteLine("Enter value");

n = Convert.ToInt32(Console.ReadLine());

for (int i = 1; i <= n; i++)

{

k = 0;

no = n - 2;

for (int j = 1; j <= i; j++)

{

if (j == 1)

{

Console.Write(i);

}

else if (j == 2)

{

k = k + i + (n - (j - 1));

Console.Write(" " + k);

}

else

{

k = k + no;

Console.Write(" " + k);

no--;

}

}

Console.WriteLine("");

}

Console.ReadKey();

}

}

}

Output of the above program :
output.PNG