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 --- 45/CH12/EX12.4/example_12_4.sce | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 45/CH12/EX12.4/example_12_4.sce (limited to '45/CH12/EX12.4/example_12_4.sce') diff --git a/45/CH12/EX12.4/example_12_4.sce b/45/CH12/EX12.4/example_12_4.sce new file mode 100755 index 000000000..16ba150ff --- /dev/null +++ b/45/CH12/EX12.4/example_12_4.sce @@ -0,0 +1,18 @@ +//Example 12.4 +clc +clear +V_A=0 +//a=input("Enter the binary digit(5 bits) :" ); +a=11010 +for i=1:5 + r=modulo(a,10); + b(1,i)=r; + a=a/10; + a=floor(a); +end +for j=1:5 +V_A = V_A + 10*b(1,j)*2^(j-1); +end; +V_A=V_A/2^5; +disp("The output voltage in volts is '); +disp(V_A); // displaying the value \ No newline at end of file -- cgit