Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Develop code

EasyMediumHard
123456789101112
Question 9

Write an algorithm in pseudocode or a high-level programming language (such as Python) to convert a 6-bit binary string into its denary equivalent.

The algorithm must:

  • Repeatedly prompt the user to input a binary string until they enter a string that is exactly 6 characters long (you do not need to validate that it only contains '0' and '1').
  • Once a valid 6-character string is input:
    • Convert the binary pattern into its denary equivalent using standard positional values.
    • Print a message that contains both the original binary string and the calculated denary equivalent.
  • Include at least one comment explaining how the conversion process works.

Conversion Example Reference:

Denary placeholder32168421
Binary number101101
Denary value3208401
32+8+4+1=45 32 + 8 + 4 + 1 = 45 32+8+4+1=45
[11]

Develop code Questions

  1. IGCSE
  2. /Computer Science
  3. /Develop code