title: Square Root Of An Integer
signature: function squareRootOfAnInteger($x) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($x, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($x), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        89, 
        9));
      
      printf("TEST-1...%s\n",driver(
        11, 
        3));
      
      printf("TEST-2...%s\n",driver(
        14, 
        3));
      
      printf("TEST-3...%s\n",driver(
        92, 
        9));
      
      printf("TEST-4...%s\n",driver(
        76, 
        8));
      
      printf("TEST-5...%s\n",driver(
        63, 
        7));
      
      printf("TEST-6...%s\n",driver(
        51, 
        7));
      
      printf("TEST-7...%s\n",driver(
        16, 
        4));
      
      printf("TEST-8...%s\n",driver(
        83, 
        9));
      
      printf("TEST-9...%s\n",driver(
        66, 
        8));
      
  }
  
  main();
  ?>
source_py: def square_root_of_an_integer(x):
      if ((x == 0) or (x == 1)):
          return x
      i = 1
      result = 1
      while (result <= x):
          i += 1
          result = (i * i)
      return (i - 1)
source_cpp: int square_root_of_an_integer(int x) {
    if ( x == 0 || x == 1 ) return x;
    int i = 1, result = 1;
    while ( result <= x ) {
      i ++;
      result = i * i;
    }
    return i - 1;
  }