title: Sum Series 0 6 0 06 0 006 0 0006 N Terms
signature: func sumSeries06006000600006NTerms(n int) float64 {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual float64, expected float64) bool {
      return math.Abs(actual - expected) < 1e-09
  }
  
  func driver(n int, expected float64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(1, 0.5994)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(2, 0.65934)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(3, 0.665334)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(4, 0.6659334)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(5, 0.6659933400000001)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(74, 0.666)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(77, 0.666)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(67, 0.666)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(9, 0.665999999334)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(12, 0.665999999999334)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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 ) );
  }