title: Square Root Of An Integer
signature: square_root_of_an_integer <- function(x) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(x, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(x), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          89L, 
          9L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          11L, 
          3L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          14L, 
          3L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          92L, 
          9L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          76L, 
          8L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          63L, 
          7L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          51L, 
          7L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          16L, 
          4L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          83L, 
          9L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          66L, 
          8L
      )))
  
  }
  
  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;
  }