Code
Imports System
Module Program
Sub Main(args As String())
Dim a, g, c As Integer
c = 0
Dim r As Random = New Random
a = r.Next(1, 100)
Do While (a <> g)
Console.WriteLine("guess your number")
g = Console.ReadLine()
If g < a Then
Console.WriteLine("enter a greater number")
ElseIf g > a Then
Console.WriteLine("enter a smaller number")
End If
c = c + 1
Loop
Console.WriteLine(" your guess was right ")
Console.WriteLine("you took " & c & " attempts to win")
End Sub
End Module
No comments:
Post a Comment