코딩테스트/lv0

[프로그래머스 코딩테스트] java Lv.0 옷가게 할인받기

chantleman 2024. 7. 9. 11:42

class Solution {
    public int solution(int price) {
        int answer = 0;
        

    if(price>=500000) answer=(int)(price*0.8);
    else if(price>=300000) answer=(int)(price*0.9);
    else if(price>=100000) answer=(int)(price*0.95);
    else answer=price;
    return answer;

    }
}

처음에 30만원을 먼저 써서 틀렸습니다.