From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 55/CH6/EX6.8/6ex8.sci | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 55/CH6/EX6.8/6ex8.sci (limited to '55/CH6/EX6.8') diff --git a/55/CH6/EX6.8/6ex8.sci b/55/CH6/EX6.8/6ex8.sci new file mode 100755 index 000000000..363556d2c --- /dev/null +++ b/55/CH6/EX6.8/6ex8.sci @@ -0,0 +1,11 @@ +function [k]= myfunc(n,r) +k=factorial(n)/(factorial(n-r)*factorial(r)); +endfunction +k=myfunc(8,3); +disp(k,'the number of committees of three that can be formed out of eight people') + +cows=myfunc(6,3) //number of ways that a farmer can choose 3 cows out of 6 cows +pigs=myfunc(5,2) //number of ways that a farmer can choose 2 pigs out of 5 pigs +hens=myfunc(8,4) //number of ways that a farmer can choose 4 hens out of 8 hens +p=cows*pigs*hens; +disp(p,'total number of ways that a farmer can choose all these animals') \ No newline at end of file -- cgit