
CodePudding user response:
Running results, 28 years, for reference only.# include & lt; stdio.h>
Int main (void)
{
Int I, p, s;
for(i=1; i<40; I++)
{
P=40 + I;
S=6 + I;
If (p==2 * s)
{
Printf (" Years: \ n \ t % d ", I);
break;
}
}
}
CodePudding user response:
# include & lt; stdio.h>
Int main (void)
{
int i=0;
Int father_age son_age;
Father_age=40;
Son_age=6;
While (1) {
Father_age=40 + I;
Son_age=6 + I;
If (father_age/son_age==2 & amp; & Son_age father_age %==0) {
Printf (" % d, % d \ n ", father_age, son_age);
break;
}
i++;
}
Printf (" % d \ n ", I);
# if 0
for(i=1; i<40; I++)
{
P=40 + I;
S=6 + I;
If (p==2 * s)
{
Printf (" Years: \ n \ t % d ", I);
}
}
# endif
}
For your reference ~