Log in base 2 in c++

Discussion on C, C++ and C++11 at the COJ. This is the place to clear your doubts about these languages, and to share with the community the new things you learn about them.
Posts: 11
Joined: Thu Apr 05, 2012 9:36 pm
Gender: None specified

Log in base 2 in c++

Postby Spartan » Thu May 16, 2013 7:06 pm

How can i calculate the log in base 2 of a number in C++?

User avatar
COJ Administrator
Posts: 1968
Joined: Sun Nov 13, 2011 12:32 pm
Location: Universidad de las Ciencias Informáticas
Gender: None specified

Re: Log in base 2 in c++

Postby ymondelo20 » Thu May 16, 2013 11:01 pm

With the function log2(num) ... from the math library.
"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

Return to “C/C++/C++11”

Who is online

Users browsing this forum: No registered users and 1 guest