I am creating a piece of code that lets the user input a number and it picks a random number from in between 1 and the number the user inputted. I have done a bit so far but it always pick the same number. So for six it is 5. Can you help please
Dim random As Integer
Dim sides As Integer
Sub Main()
Console.WriteLine("How many sides are on the dice?")
sides = Console.ReadLine
random = CInt(sides * Rnd()) + 1
Console.WriteLine("the number is " & random)
Console.ReadLine()
End Sub
Aucun commentaire:
Enregistrer un commentaire