summaryrefslogtreecommitdiff
path: root/3809/CH26/EX26.4/EX26_4.sce
blob: 33ea89a9f2a7dc19ee8b90bc599062109e07cec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Chapter 26, Example 26.4

clc
//Initialisation
x=5               //decimal number to be convert
y=65536             //2^16 decimal number


//Calculation
z=y-x                           //subtraction from 2^16 number
z1=dec2bin(z)                  //conversion to binary

//Results
printf("-5 as a 16 bit signed number = %s",z1)