Visual Basic (VB) program to check whether a string is Palindrome or not.
- Use of StrReverse() Function
Program :
Sub Palindrome()
Dim s As String
s = InputBox("Enter a string")
If s = StrReverse(s) Then
MsgBox s & (" is a palindrome")
Else
MsgBox s & (" is not a palindrome")
End If
End Sub
Note: Copy the code and run in Microsoft Visual Basic Editor.(Microsoft Excel)
- Use of StrReverse() Function
Program :
Sub Palindrome()
Dim s As String
s = InputBox("Enter a string")
If s = StrReverse(s) Then
MsgBox s & (" is a palindrome")
Else
MsgBox s & (" is not a palindrome")
End If
End Sub
Note: Copy the code and run in Microsoft Visual Basic Editor.(Microsoft Excel)
No comments:
Post a Comment