summaryrefslogtreecommitdiff
path: root/3836/CH5/EX5.1/Ex5_1.sce
diff options
context:
space:
mode:
Diffstat (limited to '3836/CH5/EX5.1/Ex5_1.sce')
-rw-r--r--3836/CH5/EX5.1/Ex5_1.sce18
1 files changed, 18 insertions, 0 deletions
diff --git a/3836/CH5/EX5.1/Ex5_1.sce b/3836/CH5/EX5.1/Ex5_1.sce
new file mode 100644
index 000000000..5c096fca7
--- /dev/null
+++ b/3836/CH5/EX5.1/Ex5_1.sce
@@ -0,0 +1,18 @@
+clear
+//Initialisation
+n=8 //8 bit
+n2=16 //16 bit
+n3=32 //32 bit
+
+//Calculation
+c=2**n //value for 8 bit
+c2=2**n2 //value for 16 bit
+c3=2**n3 //value for 32 bit
+
+//Result
+printf("\n An 8-bit word can take 2^8 = %d values\n",c)
+
+printf("\n An 16-bit word can take 2^16 = %d values\n",c2)
+
+printf("\n An 32-bit word can take 2^32 = %f x 10^9 values\n",c3/10**9)
+