import Foundation
func solution(_ price:Int) -> Int {
let price = Double(price)
switch price {
case 100000..<300000 :
return Int(price * 0.95)
case 300000..<500000 :
return Int(price * 0.9)
case 500000... :
return Int(price * 0.8)
default :
return Int(price)
}
}
'프로그래머스 > Lv.0' 카테고리의 다른 글
[Swift] 외계어 사전 (0) | 2023.01.05 |
---|---|
[Swift] 옹알이 (1) (0) | 2023.01.05 |
[Swift] 영어가 싫어요 (0) | 2022.12.26 |
[Swift] 연속된 수의 합 (0) | 2022.12.26 |
[Swift] 양꼬치 (0) | 2022.12.26 |