Exercise 3

The base 2 logarithm of a number is defined by:

log2 X = n if 2n = X

For example

log2 32 = 5, because 25 = 32

log2 1024 = 10, because 210 = 1024

Write a program that inputs a number and outputs its base 2 logarithm.
Use floating point input.
This problem would be easy, but the Math package does not have a base 2
logarithm method.
Instead you have to do this:

log2 X = (loge X) / (loge 2)

Here, loge X is the natural logarithm of X,
which you can compute using

Exercise 4

The harmonic mean of two numbers is given by:

H = 2 / ( 1/X + 1/Y )

This is sometimes more useful than the more usual average
of two numbers.
Write a program that inputs two numbers (as floating point)
and writes out both the usual average (the arithmetic mean)
and the harmonic mean.