#!/usr/bin/python
# coding:utf-8
from __future__ import print_function, unicode_literals
import sys


N = 0.01


def main():
    # input
    print("Input a number for square root calculation.")
    try:
        input = sys.stdin.readline().strip("\n")
    except KeyboardInterrupt:
        sys.exit()
    try:
        input = float(input)
    except ValueError:
        sys.exit("input error")

    # calculate and output
    print("loop: "+str(sb_sqrt(input)))
    print("recursive: "+str(sb_sqrt2(input)))


def sb_sqrt(target):
    """square root calculation by loop.
    """
    r = N
    while r * r < target:
        r += N
    # r -= N

    return r


def sb_sqrt2(target):
    """square root calculation by recursive and clojure.
    """
    def _(r):
        # print("deb1:"+str(r))
        if r * r < target:
            # print("deb2:"+str(r))
            return _(r+N)
            # print("deb3:"+str(r))
        else:
            # print("deb4:"+str(r))
            return r

    return _(N)


if __name__ == "__main__":
    main()
