Introduction
This code snippet is checking given string is a Palindrome or Not Using C#
Code
using System;
public class Program
{
public static void Main()
{
string strContent = "malayalam";
char[] charArr = strContent.ToCharArray();
Array.Reverse(charArr);
string rev = new string (charArr);
if (strContent == rev)
{
Console.WriteLine("The given string is a Palindrome!!");
}
else
{
Console.WriteLine("The given string is not a Palindrome!!");
}
}
}Output
The given string is a Palindrome!!
Demo : https://dotnetfiddle.net/ywf6Zd
