summaryrefslogtreecommitdiff
path: root/2492/CH8/EX8.1/ex8_1.sce
blob: 8d48771cbdbfbe8e1adbb12c6e7d2dee79e507ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Exa 8.1
format('v',9)
clc;
clear;
close;
// Given data
str= '3BF';// given number in hexadecimal to convert into binary
str_in_dec= hex2dec(str);// decimal equivalent
str_in_bin= dec2bin(str_in_dec);// binary equivalent
disp(str_in_bin,"The binary equivalent of 3BF is : ")

// Note : The answer in the book is wrong because binary equivalent of B = 1011 and in the book they used 1101 which is wrong.