code.javascript 297 B

12345678
  1. // returns true if prob * prize > pay; otherwise return false.
  2. // To illustrate, profitableGamble(0.2, 50, 9) should yield true,
  3. // since the net profit is 1 (0.2 * 50 - 9), and 1 > 0.
  4. function profitableGamble(prob, prize, pay) {
  5. if ((prob * prize) > pay){return true;}
  6. else {return false;}
  7. }