Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Guess the Number

Simulate a number guessing game! The secret number is 7. Start guessing at 1 and keep going up by 1 until you find it. Print each guess, then print how many guesses it took.

Expected output:

text
Guessing 1...
Guessing 2...
Guessing 3...
Guessing 4...
Guessing 5...
Guessing 6...
Guessing 7...
Found it in 7 guesses!

Hints:

  • Use a loop with break or a while loop
  • Keep a counter for the current guess
  • When the guess equals 7, print the final message and stop
rust
fn main() {
}