코딩테스트/Python

[프로그래머스/Python] 두 정수 사이의 합

짐니♡ 2025. 9. 22. 21:33

 

 

def solution(a, b):

    total = 0
    
    if(a<=b):
        for i in range(a,b+1):
            total += i
    else:
        for i in range(b,a+1):
            total +=i
    
    return total