title: Middle Of Three Using Minimum Comparisons 1
signature: func middleOfThreeUsingMinimumComparisons1(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(43, 
  	24, 
  	7, 24)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(76, 
  	54, 
  	66, 66)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(57, 
  	5, 
  	40, 40)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(10, 
  	13, 
  	4, 10)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(59, 
  	47, 
  	56, 56)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(92, 
  	14, 
  	50, 50)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(49, 
  	62, 
  	65, 62)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(16, 
  	95, 
  	12, 16)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(33, 
  	41, 
  	90, 41)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(66, 
  	63, 
  	46, 63)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def middle_of_three_using_minimum_comparisons_1(a, b, c):
      if (a > b):
          if (b > c):
              return b
          elif (a > c):
              return c
          else:
              return a
      elif (a > c):
          return a
      elif (b > c):
          return c
      else:
          return b
source_cpp: int middle_of_three_using_minimum_comparisons_1(int a, int b, int c) {
    if ( a > b ) {
      if ( b > c ) return b;
      else if ( a > c ) return c;
      else return a;
    }
    else {
      if ( a > c ) return a;
      else if ( b > c ) return c;
      else return b;
    }
  }