Question: Program to print the following pattern.
12344321
123321
1221
11
Code Snippet:
12344321
123321
1221
11
Code Snippet:
- using System;
- public class Pattern
- {
- public static void Main()
- {
- int row, col, n;
- Console.Write("Enter the row: ");
- n=Convert.ToInt32(Console.ReadLine());
- int temp = n;
- for(row=n; row>=1; row--)
- {
- for(col = 1; col<=temp; col++)
- Console.Write("{0} ", col);
- for(col=temp; col>=1; col--)
- Console.Write("{0} ", col);
- temp--;
- Console.WriteLine();
- }
- Console.ReadLine();
- }
- }
![]() |
Fig: Screenshot of Output |