Reverse a string in C#

 

Reverse a string in C#

In this article we will see how to Reverse a string in C#

  public static void Reverse()

        {

            Console.Write("Enter the string : ");

            string inputString = Console.ReadLine();

            string result = "";

            for (int i = inputString.Length - 1; i >= 0; i--)

                result += inputString[i];

 

            Console.WriteLine(result);

        }


Output














Share this

Related Posts

Previous
Next Post »