title: Add Two Numbers Without Using Arithmetic Operators
signature: func addTwoNumbersWithoutUsingArithmeticOperators(x int, y 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(x int, y int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(x, y),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(56, 
  	60, 116)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(17, 
  	44, 61)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(73, 
  	96, 169)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(75, 
  	3, 78)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(27, 
  	54, 81)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(61, 
  	1, 62)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(65, 
  	63, 128)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(22, 
  	19, 41)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(61, 
  	9, 70)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(97, 
  	23, 120)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def add_two_numbers_without_using_arithmetic_operators(x, y):
      while (y != 0):
          carry = (x & y)
          x = (x ^ y)
          y = (carry << 1)
      return x
source_cpp: int add_two_numbers_without_using_arithmetic_operators(int x, int y) {
    while ( y != 0 ) {
      int carry = x & y;
      x = x ^ y;
      y = carry << 1;
    }
    return x;
  }