Shift the original number to the right by 4 bits, and then store the result of summing with FF in the array.
Move four places to the right. . .
Do only one loop, and pay attention to the sequence number of the storage array from large to small.
Just give an idea and write your own code.