// Calculate the harmonic mean of the first 5 prime numbers

#include<iostream>
using namespace std;

int main (void)
{
    double n1 = 2, n2 = 3, n3 = 5, n4 = 7, n5 = 11;
    double sum, harmonic_mean;

    // Sum the reciprocals of the 5 primes
    sum = 1/n1 + 1/n2 + 1/n3 + 1/n4 + 1/n5;

    // Divide the sum by 5
    sum = sum / 5;

    // The harmomic mean is the reciprocal of the sum
    harmonic_mean = 1/sum;

    cout << "The harmonic mean of "
            << n1 << " "
            << n2 << " "
            << n3 << " "
            << n4 << " "
            << n5 << " is " << harmonic_mean << endl;

    return 0;
}

*****  OUTPUT  *****

The harmonic mean of 2 3 5 7 11 is 3.94602