This commit is contained in:
2024-09-22 01:11:19 -04:00
parent f72db412f2
commit 28b06df376
23 changed files with 32 additions and 376 deletions
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"fmt"
"math/rand"
)
func main() {
tries := 1
randNum := rand.Intn(10) + 1 // Generate a number between 1 and 10
for tries <= 5 {
var x int
fmt.Print("Guess a Number between 1 and 10: ")
fmt.Scan(&x)
if randNum == x {
fmt.Println("That's great, you got the right number!")
return
} else {
fmt.Println("Guess again")
}
tries++
}
fmt.Printf("The right number was %d\n", randNum)
}