Algorithm/basic

Swift - Operator 2

Teol 2023. 10. 23. 00:01

 

문제 : 시급 계산기

   +기본 시급은 5000원

   +8시간 넘을 경우 시급의 1.5배

func jop_cul ( input : Int ) -> Int {


    if (input > 8) {

       return ((input - 8) * 7500) + ( 8 * 5000)
    }

    else {

        return input * 5000
    }

}

print("노동 시간 입력 : ", terminator: "")

var jop_time = Int(readLine()!)!

print("총 임금은 ", jop_cul(input: jop_time))

'Algorithm > basic' 카테고리의 다른 글

Swift - if 1  (0) 2023.10.26
Swift - Operator 5  (0) 2023.10.25
Swift - Operator 4  (0) 2023.10.24
Swift - Operator 3  (0) 2023.10.24
Swift - Operator 1  (0) 2023.10.22