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.4/6ex4.sci | |
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.4/6ex4.sci')
-rwxr-xr-x | 55/CH6/EX6.4/6ex4.sci | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/55/CH6/EX6.4/6ex4.sci b/55/CH6/EX6.4/6ex4.sci new file mode 100755 index 000000000..a7ee4ddc6 --- /dev/null +++ b/55/CH6/EX6.4/6ex4.sci @@ -0,0 +1,14 @@ +function [k]=func1(n,r) //calculating binomial coefficient
+k=factorial(n)/(factorial(r)*factorial(n-r));
+endfunction
+func1(8,2)
+func1(9,4)
+func1(12,5)
+func1(10,3)
+func1(13,1)
+
+p = factorial(10)/(factorial(10-7)*factorial(7)); //calculating 10C7
+q= factorial(10)/(factorial(10-3)*factorial(3)) //calculating 10C3
+disp(p,'value of 10C7 is')
+//10-7=3 so 10C7 can also be computed as 10C3
+//both p and q have same values but second method saves time and space
\ No newline at end of file |