A better way is to use your calculator to convert your binary number into hex, or alternatively, if the calculator does not support such a function, find something on the web that does.
C does not offer many alternative ways. Doing it at runtime wastes cpu cycles, but it isn't terrible.