15,916,180 members
1.00/5 (1 vote)
See more:
Please i needed to a working pseudo code for converting any binary code to its equivalent decimal representation
Posted
Updated 4-Nov-22 18:01pm

## Solution 1

It's not complex: all you need to do is use the modulus and divide operators until there is no number left:

1) Set `inp` to binary number.
2) Set `digit` to `inp` modulus 10. Output `digit`
3) Set `inp` to `inp` divided by 10
4) If `inp` is not zero, repeat from (2)

The only complication is that this generates the digits in the wrong order: least significant first. So you will need to make your "Output Digit" cope with that, and probably store them in reverse order for output at the end. Exactly how you do that isn't complex, but I don't know how far you have got in your course, so I won't suggest anything - you have probably got an idea from the lecture that this was the homework from.

Genene Tise 28-Nov-22 14:54pm
what is inp??
OriginalGriff 28-Nov-22 15:04pm
After 9 years you expect me to remember? :laugh:

What do you y=think it might be?