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
What are the basic string operations? Explain.
In .NET how can you solve the DLL Hell problem?
What are the differences between events and delegates in c#?
What is jagged array in c#?
What is dto c#?
What is definition in c#?
What is array and arraylist?
What is difference between abstraction and encapsulation in c#?
What is a multicast c# delegate?
What is token in c#?
What is string empty?
Why do we use parameters in c#?
What does it mean to override a method?
Can we override static class in c#?
Can partial class be inherited?