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- class Program {
- static void Main(string[] args) {
- int num, rem, sum = 0, temp;
- //clrscr();
- Console.WriteLine("\n >>>> To Find a Number is Palindrome or not <<<< ");
- Console.Write("\n Enter a number: ");
- num = Convert.ToInt32(Console.ReadLine());
- temp = num;
- while (num > 0) {
- rem = num % 10; //for getting remainder by dividing with 10
- num = num / 10; //for getting quotient by dividing with 10
- sum = sum * 10 + rem;
- /*multiplying the sum with 10 and adding
- remainder*/
- }
- Console.WriteLine("\n The Reversed Number is: {0} \n", sum);
- if (temp == sum) //checking whether the reversed number is equal to entered number
- {
- Console.WriteLine("\n Number is Palindrome \n\n");
- } else {
- Console.WriteLine("\n Number is not a palindrome \n\n");
- }
- Console.ReadLine();
- }
- }
Output

Onkar SharmaPosted Dec 31, 2024, 3:30 PM
For a comprehensive guide on the Palindrome program in C#, take a look at this detailed article. https://www.c-sharpcorner.com/article/explaining-palindrome-program-in-c-sharp/
shazia vohraPosted Jul 21, 2022, 2:45 PM
Please Explain why you first find remainder and then quotient what is the logic behind . Any help will be highly appropriated
Shiv Ratan KumarPosted Dec 10, 2019, 2:37 AM
Public static void Main(string[] args) { int n,r,sum=0,temp; Console.Write("Enter the Number: "); n = int.Parse(Console.ReadLine()); temp=n; while(n>0) { r=n%10; sum=(sum*10)+r; n=n/10; } if(temp==sum) Console.Write("Number is Palindrome."); else Console.Write("Number is not Palindrome"); }