From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 3836/CH21/EX21.1/Ex21_1.sce | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 3836/CH21/EX21.1/Ex21_1.sce (limited to '3836/CH21/EX21.1/Ex21_1.sce') diff --git a/3836/CH21/EX21.1/Ex21_1.sce b/3836/CH21/EX21.1/Ex21_1.sce new file mode 100644 index 000000000..8187556cf --- /dev/null +++ b/3836/CH21/EX21.1/Ex21_1.sce @@ -0,0 +1,17 @@ +clear +//Initialization +ni=11010 //binary number + +//Calculation +deci = 0 +i = 0 +while ni>0 + rem = ni-int(ni/10.)*10 + ni = int(ni/10.) + deci = deci + rem*2**i + i = i + 1 + +end +//Declaration +printf("\n Decimal Equivalent = %f",deci) + -- cgit