Skip to content

The Number Guessing Game is an interactive C program where the player guesses a random number. Feedback is given for each guess: "Lower number, please" if too high, and "Higher number, please" if too low. The game displays the total attempts upon a correct guess, using loops and a random number generator for an engaging experience.

License

Notifications You must be signed in to change notification settings

shivankushsingh09/Number-Guessing-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Table of Contents

Features

  • 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.

Technologies Used

  • Programming Language: C

Installation

To compile and run the Number Guessing Game, follow these steps:

  1. Clone the repository:

       git clone https://github.com/shivankushsingh09/Number-Guessing-Game.git
       cd Number-Guessing-Game
    
  2. 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
  1. Run the program:

After compiling, you can run the executable:

   ./number_guessing_game

Usage

  1. Start the Game:

    • When you run the program, it will prompt you to guess a number within a predefined range.
  2. Input Your Guess:

    • Enter your guess when prompted. The program will indicate whether your guess is too high or too low.
  3. Try to Guess the Number:

    • Continue guessing until you either guess the correct number or run out of attempts.
  4. 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.

Example

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.

Contributing

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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any inquiries or feedback, please contact:

About

The Number Guessing Game is an interactive C program where the player guesses a random number. Feedback is given for each guess: "Lower number, please" if too high, and "Higher number, please" if too low. The game displays the total attempts upon a correct guess, using loops and a random number generator for an engaging experience.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages