코딩테스트/Python

[프로그래머스/Python] 하샤드 수

짐니♡ 2025. 9. 24. 00:07

 

def solution(x):
    
    a = str(x)
    total = 0

    
    for i in range(0,len(a)):
        total += int(a[i])
        
        
    
    if x%total == 0:
        return True
    else:
        return False