I’m trying to come up with the code for this question:
Ask the user to enter ten numbers and then dislpay the largest one
I have so far come up with this, but looking at how it would be implimented, I can only see errors:
Sub Main()
Dim One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten As String
Console.WriteLine("Please enter your first number")
One = Console.ReadLine
Console.WriteLine("Please enter your second number")
Two = Console.ReadLine
Console.WriteLine("Please enter your third number")
Three = Console.ReadLine
Console.WriteLine("Please enter your fourth number")
Four = Console.ReadLine
Console.WriteLine("Please enter your fifth number")
Five = Console.ReadLine
Console.WriteLine("Please enter your sixth number")
Six = Console.ReadLine
Console.WriteLine("Please enter your seventh number")
Seven = Console.ReadLine
Console.WriteLine("Please enter your eighth number")
Eight = Console.ReadLine
Console.WriteLine("Please enter your nineth number")
Nine = Console.ReadLine
Console.WriteLine("Please enter your tenth number")
Ten = Console.ReadLine
If Ten > Nine Then
Console.WriteLine("Your biggest number is" & Ten)
Else
If Nine > Eight Then
Console.WriteLine("Your biggest number is" & Nine)
Else
I need to see what the biggest number is. Another pupil is using an array to achieve this, but I cannot seem to work them out yet.
So after the user enters the numbers, how can I achieve this?
I tried (above) using If statements, but I see the code being extensive and errors arising if a person enters a larger number at the beginning, and then one at the end, as it would display only the first larger number…
You don’t need an array,
Read this and then try writing it yourself, you’ll learn much more that way 🙂