summaryrefslogtreecommitdiff
path: root/55/CH6/EX6.16/6ex16.sci
diff options
context:
space:
mode:
Diffstat (limited to '55/CH6/EX6.16/6ex16.sci')
-rwxr-xr-x55/CH6/EX6.16/6ex16.sci11
1 files changed, 11 insertions, 0 deletions
diff --git a/55/CH6/EX6.16/6ex16.sci b/55/CH6/EX6.16/6ex16.sci
new file mode 100755
index 000000000..fe221ffda
--- /dev/null
+++ b/55/CH6/EX6.16/6ex16.sci
@@ -0,0 +1,11 @@
+U=1000; //number of elements in the set of positive integers not exceeding 1000
+A=U/3; //number of elements in the subset of integers divisible by 3
+B=U/5; //number of elements in the subset of integers divisible by 5
+C=U/7; //number of elements in the subset of integers divisible by 7
+AandB=floor(U/(3*5)) //number of elements in the subset containing numbers divisible by both 3 and 5
+AandC=floor(U/(3*7)) //number of elements in the subset containing numbers divisible by both 3 and 7
+BandC=floor(U/(5*7)) //number of elements in the subset containing numbers divisible by both 5 and 7
+AandBandC=floor(U/(3*5*7)) //number of elements in the subset containing numbers divisible by 3,5 and 7
+s=U-(A+B+C)+(AandB+AandC+BandC)-(AandBandC); // By inclusion-exclusion principle
+S=round(s);
+disp(S,'The number of integers in the set U, which are not divisible by 3,5 and 7 is') \ No newline at end of file