Showing posts with label palindrome of a number. Show all posts
Showing posts with label palindrome of a number. Show all posts

07 January 2012

palindrome in console applications

string str = string.Empty;
Console.WriteLine("Enter a String");
string s = Console.ReadLine();
int i = s.Length;
for (int j = i - 1; j >= 0; j--)
{
    str = str + s[j];
}
if (str == s)
    Console.WriteLine(s + " is palindrome");
else
    Console.WriteLine(s + " is not a palindrome");