write a program to get a name from user and will show like below
if name is 'arupa' then
a
ar
aru
arup
arupa
arupa
arup
aru
ar
a

Hi,

Here is my idea. Paste this into the Main method in a Console App to see it working.

string name = "camilo";
            Stack<string> s = new Stack<string>();
            string temp = string.Empty;
            foreach (char a in name)
            {

                temp += a;
                s.Push(temp);
                Console.WriteLine(temp);
            }
            for (var i = 0; i < name.Length; i++ )
            {

                Console.WriteLine(s.Pop());
            }
            Console.ReadLine();

Hope this help.
Camilo

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.