Assignment: Converting Between Decimal and Hexadecimal to Binary
Assignment Cover Page
Name: FATHELRAHMAN
Registration No: 25035/2024
Course: Introduction to Information Technology
Instructor: Jean Biscotti
Assignment: Converting Between Decimal and Hexadecimal to Binary
1. How to Convert Decimal to Binary (Using Powers of 2 Method)
The decimal number system is base-10, and the binary system is base-2.
To convert a decimal number to binary:
- List powers of 2 starting from the largest (e.g., 128, 64, 32, 16, 8, 4, 2, 1).
- Start with the highest power of 2 that is less than or equal to the number.
- If it fits, write 1 and subtract that value.
- If it doesn't fit, write 0.
- Repeat the process until you reach 2^0.
Example: Convert 19 to Binary
2^4 = 16 -> fits in 19 -> write 1 -> 19 - 16 = 3
2^3 = 8 -> does not fit -> write 0
2^2 = 4 -> does not fit -> write 0
2^1 = 2 -> fits -> write 1 -> 3 - 2 = 1
2^0 = 1 -> fits -> write 1 -> 1 - 1 = 0
Result: 19 (decimal) = 10011 (binary)
Assignment: Converting Between Decimal and Hexadecimal to Binary
2. How to Convert Hexadecimal to Binary (Digit by Digit)
The hexadecimal system is base-16. It includes:
Numbers: 0 to 9
Letters: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Each digit in a hexadecimal number is converted separately into its 4-bit binary equivalent.
We do not combine or calculate between digits - each one is translated on its own.
Binary Equivalents:
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001
A = 1010
B = 1011
C = 1100
D = 1101
E = 1110
F = 1111
Assignment: Converting Between Decimal and Hexadecimal to Binary
Example: Convert 2F to Binary
We have two characters:
2 = 0010
F = 1111
We write them side by side:
Result: 2F (hex) = 00101111 (binary)
Conclusion:
In decimal to binary, you break the number down by powers of 2.
In hexadecimal to binary, you convert each digit separately into a 4-bit binary value.
Understanding how these systems relate is important for digital electronics, programming, and computing.