Let:
A = % fat for half-and-half
B = % fat for the other milk
C = desired % fat
x = the proportion of half-and-half
1-x = the proportion of the other milk
Ax + B(1-x) = C
Ax + B - Bx = C
Ax - Bx = C - B
(A-B)x = C - B
x = (C - B)/(A - B)
Algebra is rusty but that should be correct. If not, just run to the store. 😆