The following facts are known about the ages of A, B & C:
- You can get A's age by transposing the two digits of B's age.
- B is 10 times as old as C.
- Twice C's age equals the difference between the ages of A and B.
How old is the youngest?
When all the possible values of A's and B's ages (2-digit numbers where the digits are unequal) are used, you get the following table:
A B half the 1/10 B's
difference age
12 21 4.5 2.1
13 31 9.0 3.1
14 41 13.5 4.1
15 51 18.0 5.1
16 61 22.5 6.1
17 71 27.0 7.1
18 81 31.5 8.1
19 91 36.0 9.1
21 12 4.5 1.2
23 32 4.5 3.2
24 42 9.0 4.2
25 52 13.5 5.2
26 62 18.0 6.2
27 72 22.5 7.2
28 82 27.0 8.2
29 92 31.5 9.2
31 13 9.0 1.3
32 23 4.5 2.3
34 43 4.5 4.3
35 53 9.0 5.3
36 63 13.5 6.3
37 73 18.0 7.3
38 83 22.5 8.3
39 93 27.0 9.3
41 14 13.5 1.4
42 24 9.0 2.4
43 34 4.5 3.4
45 54 4.5 5.4
46 64 9.0 6.4
47 74 13.5 7.4
48 84 18.0 8.4
49 94 22.5 9.4
51 15 18.0 1.5
52 25 13.5 2.5
53 35 9.0 3.5
54 45 4.5 4.5 ***
56 65 4.5 6.5
57 75 9.0 7.5
58 85 13.5 8.5
59 95 18.0 9.5
61 16 22.5 1.6
62 26 18.0 2.6
63 36 13.5 3.6
64 46 9.0 4.6
65 56 4.5 5.6
67 76 4.5 7.6
68 86 9.0 8.6
69 96 13.5 9.6
71 17 27.0 1.7
72 27 22.5 2.7
73 37 18.0 3.7
74 47 13.5 4.7
75 57 9.0 5.7
76 67 4.5 6.7
78 87 4.5 8.7
79 97 9.0 9.7
81 18 31.5 1.8
82 28 27.0 2.8
83 38 22.5 3.8
84 48 18.0 4.8
85 58 13.5 5.8
86 68 9.0 6.8
87 78 4.5 7.8
89 98 4.5 9.8
91 19 36.0 1.9
92 29 31.5 2.9
93 39 27.0 3.9
94 49 22.5 4.9
95 59 18.0 5.9
96 69 13.5 6.9
97 79 9.0 7.9
98 89 4.5 8.9
There's a match, marked *** when A is 54 and B is 45. Half that difference it 4.5, and that is also 1/10 of B's age. The youngest person, C, is four and a half years old.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 10 To 99
b = 10 * (a Mod 10) + a \ 10
c = Abs(a - b) / 2
If c > 0 And b >= 10 Then
Text1.Text = Text1.Text & mform(a, "##0") & mform(b, "##0") & mform(c, "##0.0") & mform(b / 10, "##0.0")
If Abs(c - b / 10) < 0.1 Then Text1.Text = Text1.Text & " ***"
Text1.Text = Text1.Text & crlf
End If
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
|
Posted by Charlie
on 2017-12-25 14:37:12 |