Write a program to determine if string is Palindrome String
A palindrome string is the one that once reversed produces the same result as the original input string. Let us proceed with an example for the same.
For example:
Input:
MADAM
Output:
MADAM is a palindrome string
Solution:
using System;
namespace PalindromeString
{
class Program
{
static void Main()
{
var reverseStr = string.Empty;
Console.Write("Enter a string : ");
var str = Console.ReadLine();
for (var i = str.Length - 1; i >= 0; i--)
{
reverseStr += str[i].ToString();
}
if (reverseStr == str)
{
Console.WriteLine("Palindrome string");
}
else
{
Console.WriteLine("Not a Palindrome string");
}
Console.ReadLine();
}
}
}