I would suggest two small changes. The data types should be uniformly double and in the formula a bracket is set incorrectly.
double squareroot;
double mharmonic;
mharmonic = (2*num1*num2) / (num1 + num2);
The formula works even if one of the two values is zero. In any case: If at least one of the quantities to be averaged is zero, the harmonic mean is to be defined as zero. Of course, this would have to be implemented in the program.