i want out put as:
     *
   * * *
  m a h e s
* * * * * * *

So what have you written so far?

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.

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.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.