Input : Number of Rows

Output:

    1
  1 2 1
1 2 3 2 1

Code

        public static void PrintNumberPattern3(int rows)
        {
            int i, j, k, l;
            //Loop for number of Rows
            for (i = 1; i <= rows; i++)
            {
                //Loop for printing space between numbers
                for (l = 0; l < rows - i; l++)
                {
                    Console.Write("  ");
                }
                // Loop for printing numbers in increasing order
                for (j = 1; j < 2 * i + 1; j++)
                {
                    Console.Write(j + " ");
                    if (j >= i)
                    {
                        break;
                    }
                }
                // Loop for printing numbers in decreasing order
                for (k = j - 1; k > 0; k--)
                {
                    Console.Write(k + " ");
                }
                Console.WriteLine("");
            }
        }