Header Ads

Read any Four-digit number and display the number in reverse order

Dim num,rev
num= inputbox("Enter a number")
If len(num)=4 Then

rev=rev*10 + num mod 10
num=num/10
num= left(num,3)

rev=rev*10 + num mod 10
num=num/10
num= left(num,2)

rev=rev*10 + num mod 10
num=num/10
num= left(num,1)

rev=rev*10 + num mod 10

msgbox "Reverse Order of the number is "&rev
Else
msgbox "Number, you entered is not a 4 digit number"
End If

Powered by Blogger.