87.6k views
2 votes
Write a VB program that asks the user to enter their surname. It will then tell them that they have a long surname if the name they enter has more than ten characters; otherwise, it will tell them that they don’t have a long surname​

1 Answer

5 votes

Answer:

Sure, there's a VB program that does what you're asking for:

Module Module1

Sub Main()

Dim surname As String

Console.WriteLine("Please enter your surname:")

surname = Console.ReadLine()

If surname.Length > 10 Then

Console.WriteLine("You have a long surname.")

Else

Console.WriteLine("You don't have a long surname.")

End If

Console.ReadKey()

End Sub

End Module

When you run this program, it will prompt the user to enter their surname. It will then check the length of the surname and print out either "You have a long surname" or "You don't have a long surname" based on the input size. The program waits for the user to press a key before exiting.

Step-by-step explanation:

User FrankkieNL
by
7.3k points