티스토리 뷰

728x90
SMALL

 

function solution(x) {
    const string=String(x);
    let add=0;
    for(let i=0;i<string.length;i++){
        add+=parseInt(string[i]);
    }
    if(x%add===0){
        return true;
    }else{
        return false;
    }
}

 

728x90
LIST
댓글
공지사항