class Solution {
public int solution(int price) {
int answer = price;
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);
}
return answer;
}
}
'공부 > 프로그래머스' 카테고리의 다른 글
배열 뒤집기 (0) | 2024.01.26 |
---|---|
아이스 아메리카노 (0) | 2024.01.26 |
배열의 평균값 (2) | 2024.01.26 |
피자 나눠 먹기(3) (1) | 2024.01.26 |
피자 나눠 먹기(2) (0) | 2024.01.26 |