Hello, can anyone please help me with the following? I’d greatly appreciate it

Write a program which accepts 4 digit number (at least two of the digits are different) e.g. the number cannot have all the digits same. (e.g. 7029 is a valid number but not 8888). You may even accept numbers with less than 4 digits but compensate it with extra zeroes accordingly. e.g. if user input is 1 then you should accept it as 0001 which is valid input for this task.

i. Now generate a 4 digit number (smallNum) from the user input such that the digits are arranged in ascending order (i.e. in the above example it would be 0279)

ii. Now generate a 4 digit number (largeNum) from the user input such that the digits are arranged in descending order (i.e. in the above example it would be 9720)

iii. Now, find another number (num) which is num = largeNum - smallNum

iv. printout value of num.

v. Repeat from step i. (To start with, there is no terminating condition for this repeat structure).

Observe the pattern and figure out what happens with different numbers?

Once you find the pattern, write the terminating condition for the loop in comment.

Make sure that you check if the input number is at most 4 digits and at least 2 digits are different. You may assume that the user inputs are always positive integers.

Hello, can anyone please help me with that one? I’d appreciate it greatly

Write a program which accepts 4 digit number (at least two of the digits are different) e.g. the number cannot have all the digits same. (e.g. 7029 is a valid number but not 8888). You may even accept numbers with less than 4 digits but compensate it with extra zeroes accordingly. e.g. if user input is 1 then you should accept it as 0001 which is valid input for this task.

i. Now generate a 4 digit number (smallNum) from the user input such that the digits are arranged in ascending order (i.e. in the above example it would be 0279)

ii. Now generate a 4 digit number (largeNum) from the user input such that the digits are arranged in descending order (i.e. in the above example it would be 9720)

iii. Now, find another number (num) which is num = largeNum - smallNum

iv. printout value of num.

v. Repeat from step i. (To start with, there is no terminating condition for this repeat structure).

Observe the pattern and figure out what happens with different numbers?

Once you find the pattern, write the terminating condition for the loop in comment.

Make sure that you check if the input number is at most 4 digits and at least 2 digits are different. You may assume that the user inputs are always positive integers.