Generally speaking, we use the simplest ideas.
Is to put a number in, and then use the program to judge (this should be called exhaustive method in mathematics).
If you don't understand the code, you can refer to mine.
ABCD-CDC=ABC
First of all, this topic has four variables, in which A and C must not be 0, so the code can be:
Dim a is an integer, b is an integer, c is an integer and d is an integer.
Dim ABCD is an integer, CDC is an integer and ABC is an integer.
For a = 1 to 9
For b = 0 to 9
For c = 1 to 9
For d = 0 to 9
ABCD =(a * 1000+b * 100+c * 10+d)
CDC = (c * 100 + d * 10 + c)
ABC = (a * 100 + b * 10 + c)
If ABCD-CDC = ABC, then msgbox ABCD & "-"&; Centers for Disease Control and Prevention. "="&
then
then
then
then
The actual operation of this code is no different from that upstairs (it may be cumbersome and may make you easier to understand)
The purpose is to list all the possibilities of ABCD, and then use comparative judgment repeatedly.