Skip to content

A simple Java console-based game where the player has to guess a randomly generated number between 1 and 100. The game provides feedback such as "Too High" or "Too Low" until the correct number is guessed.

Notifications You must be signed in to change notification settings

harshshrivastava2005/Number-Guessing-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Number-Guessing-Game

A simple Java console-based game where the player has to guess a randomly generated number between 1 and 100. The game provides feedback such as "Too High" or "Too Low" until the correct number is guessed.

Features:

Random number generation using java.util.Random

User input via the console (Scanner)

Hint-based gameplay ("Too high", "Too low")

Tracks number of attempts

Simple and beginner-friendly code

Technologies Used:

Java (Core)

Console I/O

How to Run:

  1. Clone the repo or download the .java file

  2. Compile the code:

javac GuessNum.java

  1. Run the game:

java GuessNum

Sample Output:

Guess the number between 1 and 100 Enter Your Guess Number: 50 Too high! Enter Your Guess Number:30 Too low! Enter Your Guess Number: 40 Correct! You guessed it in 3 attempts.

Ideal For:

Java beginners Learning conditionals, loops, random numbers Small CLI-based game demos

Learning Concepts:

Loops and Conditional Statements Random number generation Console Input/Output Basic game logic

If you like this project, give it a star.

HARSH SHRIVASTAVA

Linkedin: https://www.linkedin.com/in/harsh-shrivastava-9508032a5/

About

A simple Java console-based game where the player has to guess a randomly generated number between 1 and 100. The game provides feedback such as "Too High" or "Too Low" until the correct number is guessed.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages