VB.Net Code to get Reverse of a Number
In this post, here is the VB.Net code to get the reverse of a number. You can also use this method while checking whether the number is Palindrome.
If the input number and the reversed input number are same, then the number is said to be a Palindrome.
”’ Method to get reverse of a number
”’ <param name=”Num”>Number to be reversed</param>
”’ <returns>reversed input number</returns>
Public FunctionReverseOfNum(Num As Integer) As Integer
Dim RevNum As Integer = 0
Dim Remainder As Integer = 0
‘for getting remainder by dividing with 10
‘for getting quotient by dividing with 10
‘multiplying the sum with 10 and adding remainder
RevNum = (RevNum * 10) + Remainder
Posts you may like :