Palindrome using C#

Palindrome using C#.net

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str=string .Empty ;

Console.WriteLine("Enter a String");

string s = Console.ReadLine();

int i = s.Length;
//we can get the Length of string by using Length Property

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 palindeome");
}

Console.WriteLine(str);

Console.Read();


}
}
}


Comments

Author: Mrs. Meetu Choudhary Nanda17 Feb 2009 Member Level: Gold   Points : 1


Please do provide description too along with you code to receive good responses and recognition points



Thanks and Regards
Meetu Choudhary
Editor



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: