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
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
Comments
Leave a comment