I, entitled
Xiao Ming with two sisters to attend Lantern Festival. When asked how old they are, they playfully said: "The product of the age of the two of us six times and the age of." Xiao Ming added: "They are not twins, age difference and certainly not more than 8 years old ah."
Please write: younger sister Xiao Ming.
Note: write only a person's age, number, please submit your answers via the browser. Do not write any extra content.
Second, the idea
Determine the scope of the direct cycle of violence.
Third, the problem solution
#include <iostream> using namespace std; int main() { for (int lil_sis_age=1;lil_sis_age<30;lil_sis_age++) { for (int differ=1;differ<=8;differ++) { int big_sis_age = lil_sis_age + differ; if(lil_sis_age*big_sis_age==(lil_sis_age+big_sis_age)*6) { cout << lil_sis_age << endl; } } } return 0; }
Fourth, the results
10
Process finished with exit code 0