Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Assignment #1

Submitted by : Anees ur rehman


Department: BSCS
Id : cu-1121-2020-A
Problem No 1.
Convert the following Number as directed:
(a): (986.25) 10 to Binary and Octal.
Ans: (986.25) 10 to binary

986.25×22 = 3945
Divide by the base 2 to get the digits from the remainders:
Division Remainder
by 2 Quotient (Digit) Bit #
(3945)/2 1972 1 0
(1972)/2 986 0 1
(986)/2 493 0 2
(493)/2 246 1 3
(246)/2 123 0 4
(123)/2 61 1 5
(61)/2 30 1 6
(30)/2 15 0 7
(15)/2 7 1 8
(7)/2 3 1 9
(3)/2 1 1 10
Division Remainder
by 2 Quotient (Digit) Bit #
(1)/2 0 1 11
= (111101101001)2 >> 2
= (1111011010.01)2

now decimal to octal

: decimal to octal

(986.25)10 to octal

Divide by the base 8 to get the digits from the remainders:


Division Remainder
by 8 Quotient (Digit) Digit #
(7890)/8 986 2 0
(986)/8 123 2 1
(123)/8 15 3 2
(15)/8 1 7 3
(1)/8 0 1 4
= (17322)8 >> 1
= (1732.2)8

(b):
Ans:
1101101.10112 in Binary number system and want to
translate it into Octal.
To do this, at first converting it to decimal here so :

1101101.10112 = 1∙26+1∙25+0∙24+1∙23+1∙22+0∙21+1∙20+1∙2-1+0∙2-
2
+1∙2-3+1∙2-4 = 64+32+0+8+4+0+1+0.5+0+0.125+0.0625 =
109.687510

Happened: 109.687510

Converting 109.687510 in Octal system here so:

Whole part of a number is obtained by dividing on the basis new

109 8
-
13 8
104
5 -8 1
5

Happened:10910 = 1558

The fractional part of number is found by multiplying on the basis


new

0 .6875
. 8
5 5
8
4 0

Happened:0.687510 = 0.548
Add up together whole and fractional part here so:

1558 + 0.548 = 155.548

Result of converting:
1101101.10112 = 155.548

Problem No 2:
A) Perform the subtraction using r’s and r-1’s
complement.
(I). 1972-6842
Ans :
The (r-1)'s complement of a number in
anynumber system with base r can be found
out by subtracting every single digit of a
number by r-1.so
(1972-6842 ) =(5130)
The answer is (5130).
---------------------------------------------
(ii): (101101)2-(111001)2
Ans : same to the above question.
(101101)2-(111001)2 = (010100)2
B) Represent you student ID (like 786) in the
following Code.
I. BCD
Ans :
Binary Coded Decimal, or BCD, is another
process for converting decimal numbers into
their binary equivalents
Convert (324)10 in BCD
(324)10 -> 0011 0010 0100 (BCD)
Again from the truth table above,
3 -> 0011
2 -> 0010
4 -> 0100
thus, BCD becomes -> 0001 0010 0011
II. Excess-3 code
Ans: Decimal number 31
1. i find the BCD code of each digit of the decimal number.

Digit BCD

3 0011

1 0001

2) Then, i add 0011 in both of the BCD code.

Decimal BCD Excess-3

3 0011+0011 0110

1 0001+0011 0100

3. So, the excess-3 code of the decimal number 31 is 0110 0100

II. Excess-3 code:


Ans:Excess-3 Code
In Excess-3 code, 3 is added to the individual
digit of a decimal number then these binary
equivalent are written. For example, (278)10 in
excess-3 code is represented by 0101101011.
This code is not a weighted code.
The end .

You might also like