Program for checking given string is palindrome or not Public Class Form1 Dim str As String Dim stringrev

As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click str = TextBox1.Text Dim temp(10) As Char temp = str.ToCharArray() Dim n As Integer n = temp.Length - 1 While (n >= 0) stringrev = stringrev & temp(n) n = n - 1 End While If str = stringrev Then MsgBox("given string Else MsgBox("given string is not palindrome") End If stringrev = "" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class

is palindrome")

Length . n.Length .Console Module Module1 Sub accpet(ByRef a() As Integer) Dim i As Integer For i = 0 To a.Length For i = 0 To n .Program for binary search Imports System. temp As Integer n = a.1 Else low = mid + 1 Next .1 a(i) = Val(ReadLine()) Next i End Sub Sub sort(ByRef a() As Integer) Dim i.1 WriteLine(a(i)) Next End Sub Function bsearch(ByRef a() As Integer.1 For j = i To n .Length . ByVal key As Integer) As Integer Dim low As Integer = 0 Dim high. mid As Integer high = a.1 While low <= high mid = (low + high) / 2 If a(mid) = key Then Return mid ElseIf a(mid) > key Then high = mid .1 If a(i) > a(j) Then temp = a(i) a(i) = a(j) a(j) = temp End If Next End Sub Sub display(ByRef a() As Integer) For i As Integer = 0 To a. j.

f As Long sum = 0 m = n While n <> 0 d = n Mod 10 f = 1 . key. n. iii.End If End While Return -1 End Function Sub Main() Dim a(). loc As Integer WriteLine("Enter no of elements") n = ReadLine() ReDim a(n) WriteLine("Enter elements into array") accpet(a) sort(a) WriteLine("Given elements are") display(a) WriteLine("Enter element to search") key = Val(ReadLine) loc = bsearch(a. Module Module1 Sub strong(ByVal n As Integer) Dim d. sum. Strong Number. key) If loc = -1 Then WriteLine("element not found") Else WriteLine("element found at" & loc) End If Read() End Sub End Module Develop an Visual Basic Application to Check the given number in one of categories like i. Perfect Number. ii. i. m. Palindrome.

For i = d To 1 Step -1 f = f * i Next sum = sum + f n = n / 10 End While If m = sum Then Console.WriteLine("{0} is a perfect no". remainder.WriteLine("{0} is not a strong number". n) Else Console.WriteLine("{0} is not a perfect no".WriteLine("{0} is palindrome".WriteLine("{0} is a strong number". m) Else Console. sum As Integer sum = 0 temp = n While n > 0 remainder = n Mod 10 n /= 10 sum = sum * 10 + remainder End While If sum = temp Then Console. temp) . n) End If End Sub Sub palindrome(ByVal n As Integer) Dim temp. m) End If End Sub Sub perfect(ByVal n As Integer) Dim i As Integer Dim sum As Integer = 0 For i = 1 To n / 2 If n Mod i = 0 Then sum = sum + i End If Next If sum = n Then Console.

ReadLine() Console. ch As Integer Console.Perfect number") Console.WriteLine("Enter any number") n = Console.WriteLine("2.Else Console.ReadLine() Select Case ch Case 1 strong(n) Case 2 perfect(n) Case 3 palindrome(n) Case Else Console.WriteLine("in valid choice") End Select Console.WriteLine("3.WriteLine("----------------") Console.Read() End Sub End Module Develop an Visual Basic Application to find out the factorial of the given number by using functions Module Module1 Function factorial(ByVal n As Integer) As Long Dim i As Integer Dim fact As Long = 1 For i = 1 To n fact = fact * i Next Return fact End Function Sub Main() .WriteLine("1.WriteLine("Enter choice") ch = Console. temp) End If End Sub Sub Main() Dim n.WriteLine("{0} is not palindrome".WriteLine("----------------") Console.palindrome number") Console.Strong number") Console.

WriteLine("{0} factorail is {1}". fact) Console.Dim n As Integer Dim fact As Long Console.Read() End Sub End Module . n.ReadLine fact = factorial(n) Console.WriteLine("Enter any number") n = Console.