Sunday, February 5, 2017

Palindrome Number in Visual Basic NET

In this article I would like to share with you a sample program that will ask the user to give a number and then our program written in Visual Basic NET will give if the given number is a Palindrome or Not a Palindrome. The code is very easy to understand and use.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output



Program Listing


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim num As String
        Dim sum, t, r As Integer


        num = TextBox1.Text

        sum = 0
        t = num
        While num <> 0
            r = num Mod 10
            sum = sum * 10 + r
            num = num \ 10
        End While
        If sum = t Then
            Label2.Text = " The Number " + t.ToString() + " is a Palindrome Number."
        Else
            Label2.Text = " The Number " + t.ToString() + " is NOT a Palindrome Number."
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class



No comments:

Post a Comment