However, although in many cases it is interesting that the computer itself makes some estimates and returns the results obtained, in other cases the user can also assume the role of simple observer and in order to avoid it, we try to demand the results to the user itself in our programs.
It is known that such programs make things difficult or at least make writing longer programs. Why?
The user normally does not have the answers correctly, with a single space, sorted, etc. there will be custom to enter, but you cannot be told that the answer you have entered is wrong.
For example:
228 factorization 2 2 . 3. It is 19 but the user 228 = 3 . 19. You can enter 2 2 and the answer would be correct.
At this point, the decision is usually made to clearly indicate to the user the rules that must be met when entering the answers or to leave the freedom to enter the way in which he wishes to do so (even if it is not complete).
When making this decision it is necessary to take into account, of course, that you must interpret the second way in order to check whether or not it fits your result.
The reason for this is that most of the program we are dealing with is aimed at interpreting the user's response.
The program is as follows:
Parts of the program:
Note:
In this case, the numbers are taken randomly and the resulting number can be very large, very small or be the number first. This is easy to solve if we calculate the number by multiplying by three random. Try it!