# Binary to ASCII using logical operations

I am learning Computer Architecture from Introduction to Computing Systems (2nd Edition) and am stuck on this question.

What operations can be used to convert the binary representation of 3 into ASCII representation for 3? What about binary 4 to ASCII or any other digit?

The concepts I have learnt until now are Basic Logic gates and Bit Masking so I have to use them for conversion. Can someone help me understand what my approach should be?

By looking at a ASCII table you can see that the $$4$$ least significant bits of all characters between $$0$$ and $$9$$ correspond to the respective integer representations of the numbers between $$0$$ and $$9$$, while the 4 most significant bits are always $$0011$$ (leading zeroes are not shown in the table, so keep in mind you need to pad binary numbers to 8 bits).
If $$x$$ is the binary representation of a number between $$0$$ and $$9$$, you can then obtain the ASCII representation of the corresponding character as $$x \;| \;00110000,$$
where $$|$$ denotes a bitwise logical or and the second operand is in binary.