Create algorithm that calculates LOG in visualg

Asked

Viewed 862 times

1

I’ve been given a list of exercises to do in Visualg and I’m having doubts in one of these exercises:

"Enter the number and base on which to calculate the logarithm of that number and print it."

I know it has a function that calculates logarithms in base 10(LOG) but I have no idea how to calculate logarithm without being in base 10.

1 answer

0

Mathematically:

log b(x) = log k(x) / log k(b)

where b and k are bases.

So log x in base 2 in Visualg would be:

log(x) / log(2)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.