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

Monday, January 25, 2016

Reverse String in c#

 class ReversString
    {
        static string reversText(string text)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = text.Length-1; i >= 0; i--)
            {
                sb.Append(text[i]);
            }
            return sb.ToString();
        }
        static void Main()
        {
            Console.WriteLine("Enter the string");
            string str = Console.ReadLine();
            string reversed = reversText(str);
            Console.WriteLine(reversed);
            Console.ReadLine();
        }

    }
Output:


No comments: