2012 Old Spec
Question 6
The algorithm, represented as a flowchart in Figure 4, and the variable table, Table 3, describe the converting of a 4-bit binary value into denary.
Figure 4
Table 3
Identifier | Data Type | Purpose |
---|---|---|
Column | Integer | Stores the place value (column heading) |
Answer | Integer | Stores the denary value equivalent to the bit pattern entered by the user |
Bit | Integer | Stores a 0 or 1 entered by the user |
What you need to do
- Write a program for the above algorithm.
- Test the program by showing the result of entering the values 1, 1, 0, 1 (in that order).