summaryrefslogtreecommitdiff
path: root/978/CH4/EX4.5/Example4_5.sce
blob: 65ef32328b751ad0936955ff226530437ccfe1c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//chapter-4,Example4_5,pg 489

//if A8,B8,C8,D8 is the binary in 8421 code, for 12 this would be 1100(DCBA)

//in 8421-code
A8=0

B8=0

C8=1

D8=1

//in 2421-code

D2=D8

C2=bitor(C8,D8)

B2=bitor(B8,D8)

A2=A8

printf("2421-code for 12 is\n")

printf("%.f ",D2)

printf("%.f ",B2)

printf("%.f ",C2)

printf("%.f ",A2)