What is Palindrome?

–>The name Palindrome comes from a Greek word meaning running back again.It is a number that is equal forward and backward.Example- 101,141,131

C# Code Simply write this code on your console application.

[php]

using System;

namespace PalindromeExample

{

class Program

{

static void Main(string[] args)

{

int number, remainder, sum = 0, temp;

Console.Write("Enter a number : ");

number = int.Parse(Console.ReadLine());

//store value in temporary variable

temp = number;

while (number > 0)

{

//**Devide Number by 10 and store remainder in remainder variable

//like 141 entered number divided by 10 getting remainder 1

remainder = number % 10;

//add remainder and multiply by 10 into sum

sum = sum * 10 + remainder;

//devide number by 10 like 141 devide by 10 getting quotient 14

number = number / 10;

}

//Here check value is equal or not

if (temp == sum)

{

Console.Write(temp + " is a Palindrome number.");

}

else

{

Console.Write(temp + " is not Palindrome number.");

}

Console.ReadLine();

}

}

}

[/php]

VB.Net Code

[php]

Imports System

Namespace PalindromeExample

Class Program

Private Shared Sub Main(args As String())

Dim number As Integer, remainder As Integer, sum As Integer = 0, temp As Integer

Console.Write("Enter a number : ")

number = Integer.Parse(Console.ReadLine())

‘store value in temporary variable

temp = number

While number > 0

‘**Devide Number by 10 and store remainder in remainder variable

‘like 141 entered number divided by 10 getting remainder 1

remainder = number Mod 10

‘add remainder and multiply by 10 into sum

sum = sum * 10 + remainder

‘devide number by 10 like 141 devide by 10 getting quotient 14

number = number \ 10

End While

‘Here check value is equal or not

If temp = sum Then

Console.Write(temp & " is a Palindrome number.")

Else

Console.Write(temp & " is not Palindrome number.")

End If

Console.ReadLine()

End Sub

End Class

End Namespace

[/php]