diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /55/CH6/EX6.8 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '55/CH6/EX6.8')
-rwxr-xr-x | 55/CH6/EX6.8/6ex8.sci | 11 |
1 files changed, 11 insertions, 0 deletions
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 |