practice/golearn/guess_number/guess_number.go

40 lines
572 B
Go
Raw Normal View History

2017-08-09 22:22:38 -07:00
package main
import ("fmt"
"math/rand"
"time"
)
func input(var Text string){
fmt.Printf(text)
fmt.Scan(&text)
return Text
}
func main(){
rand.Seed(time.Now().UnixNano())
var randNumber int = rand.Int()%100
stuff := true
for stuff == true{
fmt.Print("Guess a number between 1 and 100: ")
var guess int
fmt.Scan(&guess)
if guess > randNumber{
fmt.Println("Too High")
}else if guess < randNumber{
fmt.Print("Too low" + "\n")
}else if guess == randNumber{
fmt.Println("Correct")
}else{
fmt.Println("What the fuck")
}
}
}