[Tex/LaTex] How to write ‘decimal to Binary convertion ‘ in Latex

math-modetables

****

How can I make like this…plz help!

Best Answer

Try

\documentclass{article}

\usepackage{expl3}

\ExplSyntaxOn
\cs_new:Npn \displayasdecimal#1 {(#1) \sb {10}}
\cs_new:Npn \displayasoctal #1 {(\int_to_oct:n{#1}) \sb 8}
\cs_new:Npn \displayasbinary #1 {(\int_to_bin:n{#1}) \sb 2}
\ExplSyntaxOff

\begin{document}

$\displayasdecimal{311}=\displayasoctal{311}=\displayasbinary{311}$

\end{document}

This gets you

enter image description here

If you actually want to do the calculation automatically and dislay it as in the top of your picture then that would be possible too using expl3.