#the factorial of n
def fac1(n):
    s=1
    for i in range(1,n+1):
        s*=i
    return s
def fac2(n):
    if n==1:
        return 1
    else :
        return n*fac2(n-1)
def inputnum():
    a=input("please input a num:")
    return a
if __name__=='__main__':
    try :
        a=inputnum()
        print('循环求的阶乘:',fac1(eval(a)))
        print('循环求的阶乘:',fac2(eval(a)))
    except:
        print ("请输入正确的格式")
    finally:
        print ("thanks!")