title: Basic And Extended Euclidean Algorithms
signature: function basic_and_extended_euclidean_algorithms(a, b)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(a, b, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(a, b), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(46, 89, 1);
      @printf("TEST-0...%s\n",result);
      
      result = driver(26, 82, 2);
      @printf("TEST-1...%s\n",result);
      
      result = driver(40, 12, 4);
      @printf("TEST-2...%s\n",result);
      
      result = driver(58, 4, 2);
      @printf("TEST-3...%s\n",result);
      
      result = driver(25, 44, 1);
      @printf("TEST-4...%s\n",result);
      
      result = driver(2, 87, 1);
      @printf("TEST-5...%s\n",result);
      
      result = driver(8, 65, 1);
      @printf("TEST-6...%s\n",result);
      
      result = driver(21, 87, 3);
      @printf("TEST-7...%s\n",result);
      
      result = driver(82, 10, 2);
      @printf("TEST-8...%s\n",result);
      
      result = driver(17, 61, 1);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def basic_and_extended_euclidean_algorithms(a, b):
      if (a == 0):
          return b
      return basic_and_extended_euclidean_algorithms((b % a), a)
source_cpp: int basic_and_extended_euclidean_algorithms(int a, int b) {
    if ( a == 0 ) return b;
    return basic_and_extended_euclidean_algorithms ( b % a, a );
  }