Type 1:

using System;
					
public class Program
{
	public static void Main()
	{
		String strValue=Console.ReadLine();
		
		Console.WriteLine("Input String:{0}",strValue);
		
		Console.WriteLine("Reverse String:{0}",ReverseString(strValue));
	}
	
	public static string ReverseString(string inputString)
	{
		Char[] array=inputString.ToCharArray();
		Array.Reverse(array);
		return new string(array);
	}
}

Output: 
Input String:google
Reverse String:elgoog

Type 2: Using Linq, we can able to reverse the string in online of Code.

using System;
using System.Linq;
					
public class Program
{
	public static void Main()
	{
		String strValue=Console.ReadLine();		
		Console.WriteLine(new string(strValue.Reverse().ToArray()));
	}
}

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *