C# program to print left and right-aligned pattern of the given character

Pattern -1

    -
    - - 
    - - -
    - - - -
    - - - - -
    ----- till n row.

Program

using System;
using System.Collections;

namespace ConsoleApplication1
{
 
    class Program
    {
        static void Main()
        {
            int inner = 0;
            int outer = 0;
            
            int n = 0;
            char ch = ' ';

            Console.Write("Enter Value of N : ");
            n = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter Character : ");
            ch = char.Parse(Console.ReadLine());

            for (outer = 1; outer <= n; outer++)
            {
                for (inner = 0; inner < outer; inner++)
                {
                    Console.Write(ch);
                }
                Console.WriteLine();
            }
        }
    }
}

Leave a Comment

error: Alert: Content is protected!!