Homework 6

Write a program for Casino Night 2000. We have a bowl with "w" white and "b" black balls. What is the probability to get "bet" or less whites if "d" drawings are made?

The mathematical formula for w=6, b=4, d=7 and bet=1 would be

( 7 )       1       6     ( 7 )       0       7
( 1 ) * (.6)  * (.4)   +  ( 0 ) * (.6)  * (.4)
If you use the "pow" function, compile with "gcc -lm".
You can check your results by comparing them with what the executable ~jmache/cs1/bino gets.

In order to achieve modularity and simplicity, I urge you to use several functions (program and test them one by one), probably in the following way:

		  main
               	   |
	       binomialsum
                   |
		binomial
               	 / | \
  	   chose  pow  pow
          / | \
 factorial fa. factorial 

Remember:
It is due Mo 3/8, late homeworks will be penalized !
You will be graded on:

  1. correctness: (6 points)
  2. style: (4 points)