RosettaCodeData/Task/Guess-the-number-With-feedback/FreeBASIC/guess-the-number-with-feedback.basic
2023-07-01 13:44:08 -04:00

22 lines
553 B
Text

' FB 1.05.0 Win64
Randomize
Dim n As Integer = Int(Rnd * 20) + 1
Dim guess As Integer
Print "Guess which number I've chosen in the range 1 to 20"
Print
Do
Input " Your guess : "; guess
If guess > n AndAlso guess <= 20 Then
Print "Your guess is higher than the chosen number, try again "
ElseIf guess = n Then
Print "Correct, well guessed!"
Exit Do
ElseIf guess < n AndAlso guess >= 1 Then
Print "Your guess is lower than the chosen number, try again"
Else
Print "Your guess is inappropriate, try again"
End If
Loop
End