Program in C# to print the Following Pattern:
1
2 2
3 3 3
4 4 4 4
Program:
using System;
namespace pattern1234
{
class Program
{
static void Main(string[] args)
{
int i, n, k, j;
Console.WriteLine("Enter
the lines you want to print: ");
n =
Convert.ToInt32(Console.ReadLine());
for (i = 1; i
<= n; i ++)
{
for (j = 1; j
<= n - i; j++)
{
Console.Write("
");
}
for(k = 1; k
<= i; k++)
{
Console.Write("
"+i+" ");
}
Console.WriteLine();
}
}
}
}
Enter the lines
you want to print:
6
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6