title: Find Harmonic Mean Using Arithmetic Mean Geometric Mean
signature: class Solution {
  
      public decimal FindHarmonicMeanUsingArithmeticMeanGeometricMean(int a, int b) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(decimal actual, decimal expected){
              return Math.Abs(actual - expected) < 1e-09m;
          }
  
          public string driver(int a, int b, decimal expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                decimal pred_result = solution_cls.PLACEHOLDER_FN_NAME(a, b); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  54, 83, 
                  65.43065693430657m
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  42, 56, 
                  48.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  63, 12, 
                  20.16m
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  19, 76, 
                  30.4m
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  41, 50, 
                  45.054945054945065m
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  7, 26, 
                  11.030303030303031m
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  39, 42, 
                  40.444444444444436m
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  11, 64, 
                  18.773333333333333m
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  96, 81, 
                  87.86440677966101m
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  15, 54, 
                  23.47826086956522m
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def find_harmonic_mean_using_arithmetic_mean_geometric_mean(a, b):
      AM = ((a + b) / 2)
      GM = math.sqrt((a * b))
      HM = ((GM * GM) / AM)
      return HM
source_cpp: double find_harmonic_mean_using_arithmetic_mean_geometric_mean(int a, int b) {
    double AM, GM, HM;
    AM = ( a + b ) / 2;
    GM = sqrt ( a * b );
    HM = ( GM * GM ) / AM;
    return HM;
  }