ⓒ 2025 AI교육연구회 withseok. All rights reserved. (위드석)
[블로그 글 내용 상업적 이용금지] 위드석홈 | 위드석개발 | AI교육연구회

파일 다운로드

재귀함수-합구하기.py
0.00MB


def fnSumAct(n):
    if n==1:
        return 1
    else:
        return fnSumAct(n-1)+n

#재귀 호출은 1000번으로 제한함
    
''' 천번 이상 재귀 호출시
    import sys
    sys.setrecursionlimit(n)
    #n=최대횟수'''

run=1

while(run==1):

    vN=int(input("숫자입력! : "))

    print(fnSumAct(vN))
    print("")
    

 

320x100

+ Recent posts