Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write code for palindrome?

Answer Posted / dadi

static void checkPalindrome()
{
Console.WriteLine("please enter a string");
string str = Console.ReadLine();
bool isPalindrome = true;
int count = str.Length;
for (int i = 0; i < count / 2; i++)
{
if (str[i] != str[count - i - 1])
{//check char[0]==char[n-1], char[1]== char[n-2] and so on......
isPalindrome = false;
break;
}
}
Console.WriteLine("entered string {0} is {1} palindrome", str, (isPalindrome) ? "a" : "not a");
Console.Read();
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of using interface in c#?

999


What is msil in c#?

945


What does namespace mean?

930


Explain namespaces in c#.

1003


What is use of list in c#?

857


What does m mean in decimal c#?

891


What is parsing? How to parse a date time string?

1029


What Is A Satellite Assembly?

965


What is c# and why it is used for?

947


Differentiate between method overriding from method overloading with its functionality?

1023


What is the difference between method overriding and method overloading?

934


Is php easier than c#?

888


Will the following code compile and run?

979


What are constructors in c#?

955


What is iqueryable in linq?

877