[프로그래머스] 옷가게 할인 받기 (javascript)

몽슈뜨·2022년 11월 29일
0

programmers

목록 보기
26/62
post-thumbnail


🎯나의 풀이

function solution(price) {
    var answer = 0;
    if(price >= 500000){
        answer = Math.floor(price * 0.8)
    }
    
    if( price >= 300000){
        answer = Math.floor(price * 0.9)
    }
    if( price >= 100000){
        answer = Math.floor(price * 0.95)
    }
    if(price < 100000){
        answer = price
    }
    return answer;
}
profile
개발자되면 맥북사줄께

0개의 댓글