blob: 833808f03449360330949985194edc636e0e77ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//example 2.15//
//subtraction of two binary number//
clc
//clears the screen//
clear
//clears the existing variables//
x=bin2dec('1011')
//x is the minuend//
//binary to decimal conversion//
y=bin2dec('0110')
//y is the subtrahend//
z=x-y
//subtraction//
disp('the subtraction of given numbers is:')
ans=dec2bin(z)
//decimal to binary conversion//
disp(ans)
//answer in binary form//
|