title: How To Turn Off A Particular Bit In A Number
signature: func howToTurnOffAParticularBitInANumber(n int, k 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(n int, k int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n, k),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(49, 
  	15, 49)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(59, 
  	69, 59)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(76, 
  	20, 76)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(27, 
  	76, 27)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(61, 
  	60, 61)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(67, 
  	27, 67)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(63, 
  	71, 63)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(85, 
  	25, 85)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(90, 
  	64, 90)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(24, 
  	55, 24)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def how_to_turn_off_a_particular_bit_in_a_number(n, k):
      if (k <= 0):
          return n
      return (n & (~ (1 << (k - 1))))
source_cpp: int how_to_turn_off_a_particular_bit_in_a_number(int n, int k) {
    if ( k <= 0 ) return n;
    return ( n & ~ ( 1 << ( k - 1 ) ) );
  }