class StarAlpha
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the number N:");
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = {"u","m","a"};
            for (int i = 0; i < n; i++)
            {
                int stars = 1 + 2 * (i);
                int spaces = n - i;

                for (int j = 0; j < spaces; j++)
                {
                    Console.Write("  ");
                }

                for (int k = 0; k < stars; k++)
                {
                    if (stars == 5)
                        Console.Write("a" + " ");
                    else
                        Console.Write("*"+" ");
                } 
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }

I guess u won't get a pyramid shape as the number of spaces is constant throughout the program.
I think u will have to decrement it after every line u print.

Edited 6 Years Ago by pranav.falcon: n/a

class StarAlpha
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the number N:");
            int n = Convert.ToInt32(Console.ReadLine());
            
            for (int i = 0; i < n; i++)
            {
                int stars = 1 + 2 * (i);
                int spaces = n - i;
                if (i == 4)
                {
                    for (int j = 0; j < spaces; j++)
                    {
                        Console.Write("  ");
                    }

                    Console.WriteLine("u m a m a h e s h");
                }
                else
                {
                    for (int j = 0; j < spaces; j++)
                    {
                        Console.Write("  ");
                    }

                    for (int k = 0; k < stars; k++)
                    {
                       Console.Write("*" + " ");
                    }
                    Console.WriteLine();
                }
            }
            Console.ReadLine();
        }
    }

Check line number 12.
i guess it should be (i == 2) if u want the name to be printed on the third line.
Please mark this thread as solved if u have got the solution.....

This question has already been answered. Start a new discussion instead.