October 6, 2024

Conversion decimal to binary, binary to decimal, octal to binary

Conversion decimal to binary, binary to decimal, octal to binary

Decimal to binary

In computers, decimal numbers are often represented using the binary number system, which consists of only two digits: 0 and 1. Converting a decimal number to binary involves dividing the decimal number by 2 repeatedly until the quotient becomes zero, while keeping track of the remainders.

Here’s a step-by-step guide on how to convert a decimal number to binary:

  1. Start with the decimal number you want to convert.
  2. Divide the decimal number by 2.
  3. Write down the remainder (either 0 or 1) on the right side.
  4. Divide the quotient obtained in step 2 by 2 again.
  5. Write down the remainder obtained in step 4 to the left of the previous remainder.
  6. Repeat steps 4 and 5 until the quotient becomes zero.
  7. The binary representation of the decimal number is the sequence of remainders obtained from right to left.

Let’s go through an example to illustrate the process. We’ll convert the decimal number 26 to binary:

  1. Start with 26.
  2. 26 ÷ 2 = 13 (quotient), remainder = 0
  3. Write down the remainder: 0
  4. 13 ÷ 2 = 6 (quotient), remainder = 1
  5. Write down the remainder: 10
  6. 6 ÷ 2 = 3 (quotient), remainder = 0
  7. Write down the remainder: 010
  8. 3 ÷ 2 = 1 (quotient), remainder = 1
  9. Write down the remainder: 1010
  10. 1 ÷ 2 = 0 (quotient), remainder = 1
  11. Write down the remainder: 11010

Therefore, the binary representation of the decimal number 26 is 11010.

Binary to decimal

In computers, the conversion from binary to decimal is a fundamental operation. Here’s how you can convert a binary number to its decimal equivalent:

  1. Start from the rightmost digit of the binary number.
  2. Assign each digit a positional value, starting from 2^0 (1) for the rightmost digit and doubling the positional value for each subsequent digit (2^1, 2^2, 2^3, and so on).
  3. Multiply each binary digit by its corresponding positional value.
  4. Sum up all the products obtained in the previous step to get the decimal equivalent.

Let’s take an example to illustrate the process. Suppose we have the binary number 101010.

Starting from the rightmost digit:

  • 0 multiplied by 2^0 (1) equals 0.
  • 1 multiplied by 2^1 (2) equals 2.
  • 0 multiplied by 2^2 (4) equals 0.
  • 1 multiplied by 2^3 (8) equals 8.
  • 0 multiplied by 2^4 (16) equals 0.
  • 1 multiplied by 2^5 (32) equals 32.

Now, sum up the products: 0 + 2 + 0 + 8 + 0 + 32 = 42.

Therefore, the binary number 101010 is equivalent to the decimal number 42.

This method applies to binary numbers of any length. Just remember to assign the appropriate positional values and perform the multiplication and addition steps accordingly.

Octal to binary

To convert an octal number to binary in computers, you can follow these steps:

  1. Understand the octal system: The octal system is a base-8 number system, meaning it uses eight digits from 0 to 7. Each digit in an octal number represents a power of 8. For example, in the octal number 752, the digit 7 represents 7 * 8^2, the digit 5 represents 5 * 8^1, and the digit 2 represents 2 * 8^0.
  2. Convert each octal digit to its binary equivalent: To convert an octal digit to binary, you can replace it with its three-digit binary representation. The octal digits 0 to 7 correspond to the binary digits 000 to 111, respectively.
  3. Concatenate the binary equivalents: After converting each octal digit to binary, concatenate the binary equivalents to get the binary representation of the octal number.

Here’s an example:
Let’s convert the octal number 752 to binary.

Step 1: Understand the octal system: In the octal number 752, the digit 7 represents 7 * 8^2 = 448, the digit 5 represents 5 * 8^1 = 40, and the digit 2 represents 2 * 8^0 = 2.

Step 2: Convert each octal digit to binary:
7 (octal) = 111 (binary)
5 (octal) = 101 (binary)
2 (octal) = 010 (binary)

Step 3: Concatenate the binary equivalents:
1111010

Therefore, the octal number 752 is equivalent to the binary number 1111010.

Suggested readings:

First Year B Pharm Notes, Syllabus, Books, PDF Subjectwise/Topicwise

F Y B Pharm Sem-IF Y B Pharm Sem-II
BP101T Human Anatomy and Physiology I TheoryBP201T Human Anatomy and Physiology II – Theory
BP102T Pharmaceutical Analysis I TheoryBP202T Pharmaceutical Organic Chemistry I Theory
BP103T Pharmaceutics I TheoryBP203T Biochemistry – Theory
BP104T Pharmaceutical Inorganic Chemistry TheoryBP204T Pathophysiology – Theory
BP105T Communication skills TheoryBP205T Computer Applications in Pharmacy Theory
BP106RBT Remedial BiologyBP206T Environmental sciences – Theory
BP106RMT Remedial Mathematics TheoryBP207P Human Anatomy and Physiology II Practical
BP107P Human Anatomy and Physiology PracticalBP208P Pharmaceutical Organic Chemistry I Practical
BP108P Pharmaceutical Analysis I PracticalBP209P Biochemistry Practical
BP109P Pharmaceutics I PracticalBP210P Computer Applications in Pharmacy Practical
BP110P Pharmaceutical Inorganic Chemistry Practical
BP111P Communication skills Practical
BP112RBP Remedial Biology Practical