A Palindromic number or numeral Palindrome is a number, which remains the same when its digits are reversed. Like 16461, for example, it is “symmetrical”. The term palindromic is derived from Palindrome, which refers to a word (such as rotor or racecar) whose spelling is unchanged when its letters are reversed.

Example
  1. class Program {
  2. static void Main(string[] args) {
  3. int num, rem, sum = 0, temp;
  4. //clrscr();
  5. Console.WriteLine("\n >>>> To Find a Number is Palindrome or not <<<< ");
  6. Console.Write("\n Enter a number: ");
  7. num = Convert.ToInt32(Console.ReadLine());
  8. temp = num;
  9. while (num > 0) {
  10. rem = num % 10; //for getting remainder by dividing with 10
  11. num = num / 10; //for getting quotient by dividing with 10
  12. sum = sum * 10 + rem;
  13. /*multiplying the sum with 10 and adding
  14. remainder*/
  15. }
  16. Console.WriteLine("\n The Reversed Number is: {0} \n", sum);
  17. if (temp == sum) //checking whether the reversed number is equal to entered number
  18. {
  19. Console.WriteLine("\n Number is Palindrome \n\n");
  20. } else {
  21. Console.WriteLine("\n Number is not a palindrome \n\n");
  22. }
  23. Console.ReadLine();
  24. }
  25. }

Output

Palindrome in C#