summaryrefslogtreecommitdiff
path: root/3808/CH4/EX4.3/Ex4_3.sce
blob: e6c9362565a861b78f4747ecb80e985bd39ecbe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Chapter 04:Number Theory and Cryptography

clc;
clear all;

bin=[]
n=input("Enter the length of the binary number:")
dec=0
disp("Enter the digits one by one")
for i =1:n
    bin(i)=input(" ") 
end
for i=1:n
    dec=dec*2+bin(i)
end
disp(dec,"Decimal Equivalent")