Blogspot of Nickleus
Originally for school
Tuesday, March 11, 2014
Palindrome in C#
A Palindrome as define in the dictionary is "
a word, phrase, or number that reads the same backward or forward".
This can be done in C#
The C# code
private bool isTextPalindrome(string Text)
{
int low = 0, high = Text.Length - 1;
bool ans = true;
while (ans && low <= high)
{
ans = Text[low] == Text[high];
low++;
high--;
}
return ans;
}
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)