프로그래머스/Lv.0

[Swift] 피자 나눠 먹기 (2)

물복딱복준복 2023. 2. 8. 00:04
import Foundation

func solution(_ n:Int) -> Int {
    var result = 1
    while true {
        if (6 * result) % n == 0 {
            return result
        }
        result += 1
    }
}