# Palindrome in csharp

### Palindrome in csharp

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 or madam) whose spelling is unchanged when its letters are reversed.

using System;
class myFirstWindowsConsoleApp
{
public static void Main(string[] args)
{
int n,r,sum=0,temp;
Console.Write("Enter the Number: ");
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");
}
}

Output:

Enter the Number=141
Number is Palindrome.
Enter the number=143
Number is not Palindrome.

#### Palindrome number algorithm

Get the number from user

Hold the number in temporary variable

Reverse the number

Compare the temporary number with reversed number

If both numbers are same, print palindrome number

Else print not palindrome number

References

docs.microsoft.com/en-us/samples/browse/

Conclusion