title: Middle Of Three Using Minimum Comparisons 2
signature: func middleOfThreeUsingMinimumComparisons2(a int, b int, c int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(a int, b int, c int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(a, b, c),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(48, 
  	46, 
  	38, 46)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(93, 
  	34, 
  	11, 34)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(58, 
  	78, 
  	6, 58)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(13, 
  	3, 
  	23, 13)
      fmt.Printf("TEST-3...%s\n", result)
      
          
  }
source_py: def middle_of_three_using_minimum_comparisons_2(a, b, c):
      x = (a - b)
      y = (b - c)
      z = (a - c)
      if ((x * y) > 0):
          return b
      elif ((x * z) > 0):
          return
      else:
          return a
source_cpp: int middle_of_three_using_minimum_comparisons_2(int a, int b, int c) {
    int x = a - b;
    int y = b - c;
    int z = a - c;
    if ( x * y > 0 ) return b;
    else if ( x * z > 0 ) return c;
    else return a;
  }