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.
Post Reply
Spartan
Posts: 11
Joined: 6 years ago
Gender: None specified

Log in base 2 in c++

Post by Spartan » 5 years ago

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



User avatar
ymondelo20
Posts: 1968
Joined: 6 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified
Contact:

Re: Log in base 2 in c++

Post by ymondelo20 » 5 years ago

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

Post Reply

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