Skip to content

anshumanjadiya1102/Number-Guessing-Game

Repository files navigation

🎲 Number Guessing Game (Java)

A fun little project in Java where the computer picks a random number between 1 and 100 and you have to guess it. Simple, interactive, and a perfect beginner-friendly game!


✨ Features

  • 🎯 Computer randomly generates a number between 1–100
  • ⌨️ Accepts user guesses and gives hints (Too high / Too low)
  • 🔁 Unlimited attempts until you guess correctly
  • 🎉 Congratulates you with total attempts taken
  • 🚪 Exit gracefully with Ctrl+D (Linux/macOS) or Ctrl+Z (Windows)

🚀 Getting Started

1. Compile

javac Number_Guessing_Game.java

🖥️ Example Gameplay

Welcome to the Number Guessing Game!
I'm thinking of a number between 1 and 100. Try to guess it!
Press Ctrl+D (Unix/macOS) or Ctrl+Z (Windows) then Enter to exit.

Enter your guess: 50
Too low! Try again.

Enter your guess: 75
Too high! Try again.

Enter your guess: 63
🎉 Congratulations! You guessed the number in 3 tries.
Thanks for playing!

🔧 Tech Stack

  • Language: Java 11+

  • Type: CLI (Command-Line Interface)

  • Libraries: None (only Scanner & Random)

🤝 Contributing

Want to improve this little game? Fork the repo and submit a PR:

git checkout -b feature/new-idea
git commit -m "Add difficulty levels"
git push origin feature/new-idea

📜 License

This project is open-source and free to use...

💡 “Every wrong guess brings you closer to the right one!”

About

A command-line number guessing game where the user guesses until correct.

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published