Write number N in base M

Posted by VaioIsBorn on Stack Overflow See other posts from Stack Overflow or by VaioIsBorn
Published on 2010-03-20T12:08:17Z Indexed on 2010/03/20 14:11 UTC
Read the original article Hit count: 142

Filed under:
|
|

I know how to do it mathematically, but i want it now to do it in c++ using some easy algorithm. Is is possible?

The question is that i need some methods/ideas for writing a number N in base M, for example 1410 in base 3: (14)10 = 2*(3^0) + 1*(3^1) + 1*(3^2) = (112)3 etc.

© Stack Overflow or respective owner

Related posts about c++

Related posts about math