Palindrome program in VB.Net

A palindrome is a number that will show same after reverse. For example 121, 34543, 343, 131 are the palindrome numbers.

Palindrome program in VB.Net

1) First point Enter any number for check Palindrome
2) Hold the number in any variable
3) Reverse the number
4) Compare the number with reversed number
5) If both numbers are same, print palindrome number
6) Else print not palindrome number

Let’s see the palindrome program in VB.Net.

Imports System

Module Program
Sub Main(args As String())
Dim n, r, temp As Integer, sum As Integer = 0
Console.Write("Enter the Number: ")
n = Integer.Parse(Console.ReadLine())
temp = n

While n > 0
r = n Mod 10
sum = (sum * 10) + r
n = n / 10
End While

If temp = sum Then
Console.Write("Number is Palindrome.")
Console.Write("Number is not Palindrome")
End If
End Sub
End Module




Leave a Reply

Your email address will not be published.