We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Thursday, June 18, 2015

Enter the Input row number:5

*                                      *
    *                            *
        *                  *
             *       *
                 *
              *       *
         *                  *
    *                           *
*                                   *


    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the row number");
            int n = int.Parse(Console.ReadLine());
            for (int row = 0; row <= n * 2 - 1; row++)
            {
                for (int coll = 1; coll <= n * 2 - 1; coll++)
                {
                    if (row == coll || coll == 2 * n - row)
                    {
                        Console.Write("*");
                    }
                    else
                    {
                        Console.Write(" ");
                    }
                }
                Console.WriteLine();
            }

            Console.WriteLine();

            Console.ReadLine();
        }

    }

No comments: