blob: 8187556cf78b4622d181c8653c66ff7b590b6910 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)
|