summaryrefslogtreecommitdiff
path: root/3836/CH9/EX9.14/Ex9_14.sce
diff options
context:
space:
mode:
Diffstat (limited to '3836/CH9/EX9.14/Ex9_14.sce')
-rw-r--r--3836/CH9/EX9.14/Ex9_14.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/3836/CH9/EX9.14/Ex9_14.sce b/3836/CH9/EX9.14/Ex9_14.sce
new file mode 100644
index 000000000..e278ee1c6
--- /dev/null
+++ b/3836/CH9/EX9.14/Ex9_14.sce
@@ -0,0 +1,20 @@
+clear
+//Initialiation
+ni1=111011011000100 //binary number
+
+//Calculation
+
+deci = 0
+i = 0
+ni=ni1
+while (ni > 0)
+ rem = ni-int(ni/10.)*10
+ ni = int(ni/10.)
+ deci = deci + rem*2**i
+ i = i + 1
+ end
+w=deci //calling the function
+h = dec2hex(w) //decimal to hex conversion
+
+//Result
+printf("The hexadecimal equivalent of 111011011000100 is %s",h)