Question meaning Enter a four-digit number, but it may be less than four . The number obtained by the difference between the two sequences will end if it is 6174. Otherwise, the difference will be calculated as a new number. In addition, if the four-digit number is the same, output 0000. Note that It is 4 digits, less than zero padding, output operation process
Idea Input a string, convert it into 4 numbers and store it in an array a, judge whether the input is 4 digits, less than 4 digits, the array corresponds to bit 0; judge whether the four digits are the same; use printf output to control the output Number of digits; with the help of the sort function, you can get the minus and minus, convert them to numbers, calculate the difference, and re-store the difference numbers in the array; loop judgment until the result is satisfied