Answer to Question #157337 in Visual Basic for Huzaifa

Question #157337

1- Write a program that stores five names in an array of string. It gets a name from the user & displays whether the name is present in the array or not


1
Expert's answer
2021-01-26T05:34:00-0500
Module Q157337
    ''' <summary>
    ''' The start point of the program
    ''' </summary>
    ''' <remarks></remarks>
    Sub Main()
        'store five names in an array of string.
        Dim names() As String = {"Peter", "Julia", "Mike", "Mary", "Ann"}
        'get a name from the user
        Console.Write("Enter the name: ")
        Dim name As String = Console.ReadLine()
        'displays whether the name is present in the array or not
        If names.Contains(name) Then
            Console.WriteLine("The name is present in the array.")
        Else
            Console.WriteLine("The name is not present in the array.")
        End If
        'delay
        Console.ReadLine()
    End Sub
End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS