# C# Program to Check Palindrome Number

You are Here:

## What is Palindrome Number?

A palindrome number is a number that remains the same when its digits are reversed. For example, 55 is a palindrome number.

Note: The reverse of 55 is also a 55. Hence, 55 is a palindrome number.

Tips: It is recommended to use our online Palindrome Numbers calculator for better understanding.

## Check Palindrome Number

In the following example, we will check whether the given number (121) is a Palindrome number or not.

### Example

C# Compiler
using System; namespace myApp { class Program { static void Main(string[] args) { int num = 121; int copyNum = num; int reverse = 0; // reverse a number while(copyNum != 0) { reverse = reverse * 10; reverse = reverse + (copyNum % 10); copyNum = copyNum / 10; } // result if(num == reverse) Console.Write("{0} is a palindrome number", num); else Console.Write("{0} is not a palindrome number", num); } } }

### Output

121 is a palindrome number

## Palindrome Numbers between the Given Range

In the following example, we will find all the Palindrome numbers between 10 and 50.

### Example

C# Compiler
using System; namespace myApp { class Program { static void Main(string[] args) { int start = 10; int end = 50; int copyNum = 0; int reverse = 0; int flag = 0; Console.WriteLine("Palindrome numbers between {0} and {1}: ", start, end); for(start=start; start<=end; start++) { copyNum = start; reverse = 0; // reverse a number while(copyNum != 0) { reverse = reverse * 10; reverse = reverse + (copyNum % 10); copyNum = copyNum / 10; } // result if((start == reverse) && (start != 0)) { flag = 1; Console.Write(start +" "); } } if(flag == 0) Console.Write("There is no palindrome number between the given range"); } } }

### Output

Palindrome numbers between 10 and 50: 11 22 33 44

## Check Whether the Given Number is Palindrome or Not

In the following example, we will check whether the given number is a Palindrome Number or Not.

### Example

C# Compiler
using System; namespace myApp { class Program { static void Main(string[] args) { Console.Write("Enter a (int) Number: "); int num = Convert.ToInt32(Console.ReadLine()); int copyNum = num; int reverse = 0; // reverse a number while(copyNum != 0) { reverse = reverse * 10; reverse = reverse + (copyNum % 10); copyNum = copyNum / 10; } // result if(num == reverse) Console.Write("{0} is a palindrome number", num); else Console.Write("{0} is not a palindrome number", num); } } }

### Output

Enter a (int) Number: 52 52 is not a palindrome number

## Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on C# with examples for quick and easy learning.

We are working to cover every Single Concept in C#.