I’m making a console app for Computer Science that displays a message if two numbers are the same, and a different message if they’re different.
Here’s my code so far:
Module Module1
Sub Main()
Dim NumberOne As Integer
Dim NumberTwo As Integer
Console.WriteLine("Enter your first number and then press the enter key")
NumberOne = Console.ReadLine
Console.WriteLine("Now enter your second number and press the enter key")
NumberTwo = Console.ReadLine
If NumberOne = NumberTwo Then
Console.WriteLine("You entered the same two numbers!")
Console.ReadLine()
End If
If NumberOne <= NumberTwo Then
Console.WriteLine("You entered two different numbers")
Console.ReadLine()
End If
End Sub
End Module
This runs fine, but the problem is if you enter two numbers the same, it says you’ve entered the same numbers, but when you press enter, it displays the other message saying you’ve entered two different numbers.
Does anyone know how I can make it only do one or the other?
Thank you,
Jake
Please change your code:
Hope this helps!