title: Sum Series 0 6 0 06 0 006 0 0006 N Terms
signature: double sumSeries06006000600006NTerms(int n) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(double actual, double expected){
      return abs(actual - expected) < 1e-09;
  }
  
  string driver(int n, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(1, 0.5994); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(2, 0.65934); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(3, 0.665334); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(4, 0.6659334); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(5, 0.6659933400000001); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(74, 0.666); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(77, 0.666); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(67, 0.666); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(9, 0.665999999334); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(12, 0.665999999999334); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def sum_series_0_6_0_06_0_006_0_0006_n_terms(n):
      return (0.666 * (1 - (1 / pow(10, n))))
source_cpp: float sum_series_0_6_0_06_0_006_0_0006_n_terms(int n) {
    return ( 0.666 ) * ( 1 - 1 / pow ( 10, n ) );
  }