Thursday 29 May 2014

program 6: palindrome or not.


program to check the given no. is palindrome or not.

-----------------------------------------code---------------------------------------------------------


Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim n, temp, a, rev As Integer
        n = TextBox1.Text
        temp = n
        While (n > 0)
            a = n Mod 10
            rev = (rev * 10) + a
            n = n / 10
        End While
        If (temp = rev) Then
            MsgBox("Number is palindrom", , "Message")
            TextBox1.Text = ""
        Else
            MsgBox("Number is not palindron", , "Message")
            TextBox1.Text = ""
        End If
    End Sub
End Class

-----------------------------------------output----------------------------------------------------

umesh sohaliya
codestrew
umesh sohaliya
codestrew

No comments:

Post a Comment