- Andy is as old as Bruce will be when Andy will be twice as old as Bruce was when Andy's age was half the sum of their present age.
- Bruce is as old as Andy was when Bruce was half the age he will be 10 years from now.
Determine the respective present ages of each of Andy and Bruce.
For fun, I did it a slightly different way, letting the
computer do all the work. I identified 5 unknowns and
5 equations, and then just ran a looping code.
A and B are their present ages. The two "will be"s in the
first sentence refer to the same future time, say, f years
from the present. Likewise, in the first sentence the two
"was"s refer to the same time p1 years in the past.
The first sentence holds three equations:
A = B+f
A + f = 2(B - p1)
A - p1 = (A + B)/2
We are up to 3 equations and 4 unknowns.
The second sentence "was" refers to a different past time,
say p2 years ago.
B = A - p2
B - p2 = (B + 10 )/2
The code:
program age
implicit none
integer A,B,f,p1,p2
do A=1,100
do B=1,100
do f=1,100
do p1=1,100
do p2=1,100
if(A.ne.B+f .or. A+f.ne.2*(B-p1) .or. 2*(A-p1).ne.A+B
1 .or. B.ne.A-p2 .or. 2*(B-p2).ne.B+10) go to 1
print*,'A B f p1 p2 ',A,B,f,p1,p2
1 enddo
enddo
enddo
enddo
enddo
end
lord@rabbit 13158 % age
A B f p1 p2 40 30 10 5 10