Advertisement
Guest User

IsPalindrome

a guest
Oct 1st, 2016
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public static bool IsPalindrome(string number)
  2. {
  3. int min = 0;
  4. int max = number.Length - 1;
  5. while (true)
  6. {
  7. if (min > max)
  8. {
  9. return true;
  10. }
  11. char a = number[min];
  12. char b = number[max];
  13. if (char.ToLower(a) != char.ToLower(b))
  14. {
  15. return false;
  16. }
  17. min++;
  18. max--;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement