Sabari M Sabari M
Updated date Mar 23, 2021
In this code snippet, we will see how to check whether the number is palindrome or Not using C#.

The Palindromes are numbers that read the same forward as backward. For example, 5885, 78587, 32823 and etc...

C# program to check a Number is Palindrome or Not:

using System;

namespace PalindromeCheck
    class Program
        static void Main(string[] args)
            // Declaration
            var sum = 0;
            // Get input parameter
            Console.Write("Enter the Number: ");
            var input = int.Parse(Console.ReadLine());
            // Assign the value to temp variable
            var temp = input;
            // Logic to check the number is Palindrome or not
            while (temp > 0)
                var r = temp % 10;
                sum = (sum * 10) + r;
                temp = temp / 10;
            if (input == sum)
                Console.Write("Number is Palindrome.");
                Console.Write("Number is not Palindrome");


Enter the Number: 5885
Number is Palindrome.
Enter the Number: 1235
Number is not Palindrome


Sabari M
Sabari M
Software Professional, India

IT professional with 14+ years of experience in Microsoft Technologies with a strong base in Microsoft .NET (C#.Net, ASP.Net MVC, ASP.NET WEB API, Webservices,...Read More

Comments (0)

There are no comments. Be the first to comment!!!