A simple console-based Number Guessing Game developed in C. The game generates a random number, and the player has to guess it within a limited number of attempts.
- Generates a random number within a specified range.
- Provides feedback on whether the guess is too high or too low.
- Limits the number of attempts.
- Displays the number of attempts and the result of the game.
- Programming Language: C
To compile and run the Number Guessing Game, follow these steps:
-
Clone the repository:
git clone https://github.com/shivankushsingh09/Number-Guessing-Game.git cd Number-Guessing-Game
-
Compile the program:
You can compile the program using gcc. Run the following command in the terminal:
gcc -o number_guessing_game number_guessing_game.c
- Run the program:
After compiling, you can run the executable:
./number_guessing_game
-
Start the Game:
- When you run the program, it will prompt you to guess a number within a predefined range.
-
Input Your Guess:
- Enter your guess when prompted. The program will indicate whether your guess is too high or too low.
-
Try to Guess the Number:
- Continue guessing until you either guess the correct number or run out of attempts.
-
Game Over:
- If you guess the number correctly, the game will congratulate you and display the number of attempts. If you run out of attempts, the game will reveal the correct number and end.
Welcome to the Number Guessing Game!
Guess a number between 1 and 100: 50 Your guess is too low. Try again.
Guess a number between 1 and 100: 75 Your guess is too high. Try again.
Guess a number between 1 and 100: 62 Congratulations! You guessed the number in 3 attempts.
Feel free to contribute to this project by submitting issues or pull requests. If you have suggestions for improvements or features, please open an issue to discuss them.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or feedback, please contact:
- Name: Shivankush Singh
- Email: [email protected]
- GitHub: https://github.com/shivankushsingh09