C# Program to Check Whether a Number is Palindrome or Not

In this C# program, we will take input from the user and Check Whether a Number is Palindrome or Not. A number is a palindrome if the reverse of that number is equal to the original number.

C# Program to Check Whether a Number is Palindrome or Not Code:

private static void Main(string[] args)
        {
            int num, sum = 0, tempNum, remainder;
            Console.Write("Please enter the number: ");
            num = int.Parse(Console.ReadLine());
            tempNum = num;
            while (num > 0)
            {
                remainder = num % 10;
                sum = (sum * 10) + remainder;
                num = num / 10;
            }
            if (tempNum == sum)
            {
                Console.Write("Entered number {0} is a Palindrome number. ", tempNum);
            }
            else
            {
                Console.Write("Entered number {0} is not a Palindrome number. ", tempNum);
            }
            Console.ReadLine(); 
        }		

C# Program to Check Whether a Number is Palindrome or Not Output:

C#-Program-to-Check-Whether-a-Number-is-Palindrome-or-Not

C#-Program-to-Check-Whether-a-Number-is-Palindrome-or-Not

 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
6 + 3 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2022 CodingFusion
75 Important SQL Server queries you should know