From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 1332/CH1/EX1.1/1_1.pdf | Bin 0 -> 6070 bytes 1332/CH1/EX1.1/1_1.sce | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 1332/CH1/EX1.1/1_1.pdf create mode 100755 1332/CH1/EX1.1/1_1.sce (limited to '1332/CH1/EX1.1') diff --git a/1332/CH1/EX1.1/1_1.pdf b/1332/CH1/EX1.1/1_1.pdf new file mode 100755 index 000000000..ce963f2c0 Binary files /dev/null and b/1332/CH1/EX1.1/1_1.pdf differ diff --git a/1332/CH1/EX1.1/1_1.sce b/1332/CH1/EX1.1/1_1.sce new file mode 100755 index 000000000..e8854653d --- /dev/null +++ b/1332/CH1/EX1.1/1_1.sce @@ -0,0 +1,34 @@ +//Example 1.1 +//Conversion to Decimal System +//Page no. 4 +clc;close;clear; +function [s]=bas2dec(x,b) + xi=int(x) + xd=x-int(x) + s=0 + for i=1:10 + xi=xi/10 + s=s+(10*(xi-fix(xi))*b^(i-1)) + xi=int(xi) + if(xi==0) + break + end + end + for i=1:1 + xd=xd*10; + s=s+(ceil(xd)/b^(i)) + xd=xd-fix(xd) + if(xd==0) + break + end + end +endfunction + +//conversion from hexadecimal to decimal system +disp(hex2dec('1A2C'),'1A2C='); //inbuit function + +//conversion from hexadecimal to decimal system +disp(bas2dec(428.5,8),'428.5=') //inline function + +//conversion from hexadecimal to decimal system +disp(bas2dec(120.1,3),'120.1=') //inline function \ No newline at end of file -- cgit