blob: e0ff5eb8442042fe14a5b3a6283ee06f30f9426e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
//Example 2-8//
//Binary addition//
clc
//clears the console//
clear
//clears the already existing variables//
x=bin2dec('1011')
y=bin2dec('110')
//binary to decimal conversion//
z=x+y
//addition//
a=dec2bin(z)
//decimal to binary conversion//
disp(' addition of the 2 binary numbers is: ')
disp(a)
//answer in binary form//
|