A decade counter is a binary counter that is designed to count to 910, or 10012. An ordinary four-stage counter can be easily modified to a decade counter by adding a NAND gate as shown in the figure below. Notice that FF2 and FF4 provide the inputs to the NAND gate. The NAND gate outputs are connected to the CLR input of each of the flip-flops.
The counter operates as a normal counter until it reaches a count of 10102, or 1010. At that time, both inputs to the NAND gate are HIGH, and the output goes LOW. This LOW applied to the CLR input of the flip-flops causes them to reset to 0. Once the flip-flops are reset, the count may begin again.
Changing the inputs to the NAND gate can cause the maximum count to be changed. For instance, if FF4 and FF3 were wired to the NAND gate, the counter would count to 11002 (1210), and then reset.