Wednesday, 14 October 2015

Reverse a string using LINQ in C#

using System;
using System.Linq;
class Program
{
    public static void Main()
    {
        Console.WriteLine("Enter a word for reverse in C#");
        string str = Console.ReadLine();
        string reversestring = new string(str.ToCharArray().Reverse().ToArray());
        Console.WriteLine("Reverse of entered string is : {0}",reversestring);
    }
}

No comments:

Post a Comment