i should i modify this??

1. #include<stdio.h>
2. #include<conio.h>
3. main()
4. {
5. int ncr;
6. long n,r;
7. clrscr();
8. printf("\n Enter value of n and r");
9. scanf("%ld%ld",&n,&r);
10. ncr=fact(n)/(fact(r)*fact(n-r));
11. printf("\n Value of ncr=%ld",ncr);
12. getch();
13. }
14. fact(int num)
15. {
16. int i;
17. long f=1;
18. for(i=1;i<=num;i++)
19. f=f*i;
20. return(f);
21. }

i was asked to extract a function float choose(int n, int k) that will calculate
the value of C(k,n) as described. Then use it to calculate the probability P that we will get the number six k times when we throw a dice n times. This probability follows a binomial distribution with the probability mass function:
P = C(n,k)p^k (1-p)^n-k where p is the probability we will get the number six when we throw the dice once:
p = 1/6
i need to modify my program so that it outputs C(k,n) , p^k and (1-p)^n-k and P.

Can someone show me solution for this??
Topic archived. No new replies allowed.