summaryrefslogtreecommitdiff
path: root/659/CH6/EX6.1cs/Casestudy6_1.sce
diff options
context:
space:
mode:
Diffstat (limited to '659/CH6/EX6.1cs/Casestudy6_1.sce')
-rwxr-xr-x659/CH6/EX6.1cs/Casestudy6_1.sce29
1 files changed, 29 insertions, 0 deletions
diff --git a/659/CH6/EX6.1cs/Casestudy6_1.sce b/659/CH6/EX6.1cs/Casestudy6_1.sce
new file mode 100755
index 000000000..0420199b9
--- /dev/null
+++ b/659/CH6/EX6.1cs/Casestudy6_1.sce
@@ -0,0 +1,29 @@
+// Case Study:-Chapter 6, Page No:176
+// 1.Table of Binomial Coefficients
+
+MAX=10;
+printf("mx");
+for m=0:10
+ printf("%4d",m);
+end
+printf("\n-----------------------------------------------\n");
+m=0;
+//print the table of binomial coefficients for m=10
+//Computation using while loop
+while(m<=MAX)
+ printf("%2d",m);
+ x=0;
+ binom=1;
+ while(x<=m)
+ if(m==0|x==0)
+ printf("%4d",binom); //Print the result i.e. binom
+ else
+ binom=binom*(m-x+1)/x; //compute the binomial coefficient
+ printf("%4d",binom); //Print the result i.e. binom
+ end
+ x=x+1;
+ end
+ printf("\n");
+ m=m+1;
+end
+printf("-----------------------------------------------\n");