Write a visual basic program to check palindrome number

How to write a Visual basic program to check a palindrome number or check a palindrome number in visual basic.

What is a palindrome number

Before directly dive into the code. Let’s understand the problem first. A number remains the same when its digits are reversed. Example: 54345, 12321, 454 etc.

Visual basic program to check palindrome number

Now let’s see how can we write a visual basic program to check whether a number is palindrome or not

Module Module1

    Sub Main()
        Dim r, n, temp, sum As Integer
        n = 454
        sum = 0
        temp = n
        While n > 0
            r = n Mod 10
            'getting remainder  
            sum = (sum * 10) + r
            n = n / 10
        End While
        If temp = sum Then
            Console.WriteLine("palindrome number")
        Else
            Console.WriteLine("not palindrome")
        End If
        Console.ReadLine()
    End Sub

End Module

Output: palindrome number

Check out more related visual basic program with example

Vb program to find the sum of digit

Vb Program to create the multiplication table

Add a Comment

Your email address will not be published. Required fields are marked *

thirteen − 6 =