[JS] 프로그래머스 Lv.1: 정답률 78% - 부족한 금액 계산하기

ahyes·2022년 12월 18일
0
post-thumbnail

안녕하세요.
이어서 정답률 78% 문제를 풀어보겠습니다.

function solution(price, money, count) {
    var answer = 0;
    for(let i=1;i<=count;i++){
        answer+=price*i
    }
    return answer-money>0?answer-money:0;
}
profile
티스토리로 이사갑니다. https://useyhnha.tistory.com/

0개의 댓글