Your mission, even if you don't accept it, is to input three numbers from STDIN or file:
5 0.5 6
What you must do is evaluate this:
(5a + 0.5b)^6
This basically means that the first two numbers are the coefficients of a and b and the third is the exponent in a binomial expansion.
Rules:
- The first two numbers are either integers or simple terminating fractions.
- The third number is a positive integer.
- Do not use any inbuilt binomial functions from libs. (thanks to comments)
- The shortest code wins!
Go on, do it.
!at least in APL and J). Indeed, the winner of that question used J's!. It would certainly have been longer if he had to hand-code it, and assuming that this question does not allow their use. \$\endgroup\$