Wednesday, March 11, 2015

Printing the binary format of a integer

Here printing iss done thru a neat macro trick. We can calculate different way too, which is commonly seen. In that case we divide the number by 2 and not the modulo and append it to a string. Same time we will divide the number by two and make it as the new number. This process continues till the number becomes equivalent to one.

No comments:

Post a Comment