Programming fundamentals
Number Guesser in C
A C console game with validated guesses, higher-or-lower hints, and an attempt counter.
Project overview
Number Guesser in C is a small console game and programming-fundamentals exercise. It accepts a guess, checks the input, reports whether the target number is higher or lower, and counts attempts. The source uses standard C input validation and a time-seeded target from 1 to 100.
Who it's for
Beginners learning C input handling, conditions, and loops.
Project context
A small console game can make basic input handling and control flow tangible.
Inside the project
- Enter a guess and receive higher-or-lower feedback.
- Validate input and count attempts until the target is found.
- A small console exercise rather than a full product.
The work
The C program validates guesses, gives higher-or-lower hints, and counts attempts.
How it works
The program chooses a hidden integer between 1 and 100. Enter guesses and use the higher-or-lower feedback to narrow the range. On a correct answer, the program reports the number of valid attempts and ends the round.
Under the hood
The C source seeds rand with the current time, then uses a loop and conditional branches to compare guesses. scanf input is checked, out-of-range values are rejected, and invalid text is cleared from the input buffer. Only valid guesses count toward the attempt total. The project uses standard-library input, output, and random-number functions.
What to know
This is a single-round console exercise in input validation and control flow. The pseudorandom target is appropriate for a small game, not security. The repository has no detailed README; the explanation is based on numberguesser.c on its first branch.
Read the repository and source ↗Source reviewed 16 October 2026
Current state
Public programming-fundamentals repository.
