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;
}
}
'코딩테스트 예제' 카테고리의 다른 글
프로그래머스 아이스아메리카노 예제 (0) | 2023.05.12 |
---|---|
손코딩 (0) | 2023.04.18 |
프로그래머스 배열의 평균값 구하기 (0) | 2023.04.16 |
프로그래머스 피자나눠먹기3 (0) | 2023.04.15 |
간단한 배열 정렬하기! (0) | 2023.04.15 |