class Program
{
static void Main()
{
Console.WriteLine("Enter a String: ");
string str = Console.ReadLine();
string reversed = "";
for(int i = str.Length - 1; i >= 0; i--)
{
reversed += str[i];
}
Boolean equal = true;
for(int i = 0; i < str.Length; i++)
{
if (!(str[i] == reversed[i]))
{
equal = false; break;
}
}
Console.WriteLine(equal ? "String is Palindrome" : "String is not a Palindrome");
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter