π± dreaming DiNO
[νλ‘κ·Έλλ¨Έμ€] λ μμ λλμ (Kotlin) λ³Έλ¬Έ
μ μ num1, num2κ° λ§€κ°λ³μλ‘ μ£Όμ΄μ§ λ, num1μ num2λ‘ λλ κ°μ 1,000μ κ³±ν ν μ μ λΆλΆμ return νλλ‘ solution ν¨μλ₯Ό μμ±ν΄μ£ΌμΈμ.
β
μ μΆλ ₯ μ
num1
|
num2
|
result
|
3
|
2
|
1500
|
7
|
3
|
2333
|
1
|
16
|
62
|
class Solution {
fun solution(num1: Int, num2: Int): Int {
var answer: Int = 0
// double νλ³ν
var newNum1 = num1.toDouble()
var newNum2 = num2.toDouble()
var after = newNum1 / newNum2 * 1000
/*
var after = num1.toDouble() / num2.toDouble() * 1000
*/
answer = after.toInt() // Int νλ³ν
return answer
}
}
'μκ³ λ¦¬μ¦' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[νλ‘κ·Έλλ¨Έμ€] μ§μμ ν© (Kotlin) (1) | 2023.11.22 |
---|---|
[νλ‘κ·Έλλ¨Έμ€] νν (Kotlin) (0) | 2023.11.22 |