# C# program to check whether a given number is Palindrome or not

Learn: What are Palindrome numbers? Write a C# program to check whether a given number is palindrome or not.

To understand the program of palindrome number, first we should understand the concept of palindrome number.

Palindrome numbers are those numbers that are equal to its reverse.

For example:

• 121 is palindrome number.
• 112 is not a palindrome number.
• 12321 is a palindrome number.
• 12345 is not a palindrome number.

In this program, we will read an integer number and check whether it is Palindrome or not. To check palindrome, we will find its reverse number and then compare if reverse of a number if equal to its value (actual number) or not, if reverse and numbers are same then given number will be palindrome.

Consider the program:

```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{

class Program
{
static void Main(string[] args)
{
int     number    = 0;
int     tNumber   = 0;
int     rem       = 0;
int     rev       = 0;

Console.Write("Enter Number : ");
tNumber = number = int.Parse(Console.ReadLine());

//To find out total number of digits in number
while (number > 0)
{
rem = number %10;
rev = rev * 10 + rem;
number = number / 10;

}

if (rev == tNumber)
Console.WriteLine("Given Number is Palindrome");
else
Console.WriteLine("Given Number is not a Palindrome");
}
}
}
```

Output

```Enter Number : 12321
Given Number is Palindrome
```

TOP Interview Coding Problems/Challenges

Learn PCB Designing: PCB DESIGNING TUTORIAL

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.