This very simple circuit counts all the way to 9999 in decimal.
AND gates are connected to the 2^1 bit and 2^3 bit, so that when the counter reaches 1010 in binary (or 10 in decimal) the AND gate triggers and the counter is reset.
The output of the AND gate also leads to the increment input of the next decimal pace value.