Pages

Search This Blog

Check whether the number is Palindrome or not


Module Palindrome

    Sub Main()
        Dim n, r, sum, t As Integer
        Console.Write("Enter a Number:")
        n = CInt(Console.ReadLine())
        sum = 0
        t = n
        While n <> 0
            r = n Mod 10
            sum = sum * 10 + r
            n = n \ 10
        End While
        If sum = t Then
            Console.WriteLine(t.ToString() + "is a Palindrome Number")
        Else
            Console.WriteLine(t.ToString() + "is NOT a Palindrome Number")
        End If
    End Sub

End Module

15 comments:

  1. But if if in vb.net console mode I enter 64646,or 999 , it comes up as not a palindrome number. When in fact it is

    ReplyDelete
    Replies
    1. You check it again.....it will work I have tried .....I think u should should check your code again........hope this will help ...... Alvida

      Delete
  2. woow this works thanx brooo

    ReplyDelete