LardaX

IsPalindrome

Oct 2nd, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. static bool IsPalindrome(int number)
  2.         {
  3.             string numberAsString = number.ToString();
  4.             for (int i = 0; i <= numberAsString.Length - 1; i++)
  5.             {
  6.                 if (numberAsString[i] != numberAsString[numberAsString.Length - 1 - i])
  7.                 {
  8.                     return false;
  9.                 }
  10.             }
  11.             return true;
  12.         }
Advertisement
Add Comment
Please, Sign In to add comment