diff --git a/Java/lab_1/lab_1.kt b/Java/lab_1/lab_1.kt index 5562024..38039eb 100644 --- a/Java/lab_1/lab_1.kt +++ b/Java/lab_1/lab_1.kt @@ -2,7 +2,7 @@ fun protectedInput(variableName: String): Int { do { try { print("Enter $variableName: "); - return readln().toInt(); + return readln().toInt() } catch (e: Exception) { println("${variableName.uppercase()} must be an integer!"); } @@ -10,12 +10,12 @@ fun protectedInput(variableName: String): Int { } fun main() { - val n: Int = protectedInput("n"); - val m: Int = protectedInput("m"); - val a: Int = protectedInput("a"); - val b: Int = protectedInput("b"); + val n: Int = protectedInput("n") + val m: Int = protectedInput("m") + val a: Int = protectedInput("a") + val b: Int = protectedInput("b") - val s: Float = (b + m).toFloat() / 2 * (m - b + 1) * (n - a + 1); + val s: Float = (b + m).toFloat() / 2 * (m - b + 1) * (n - a + 1) println("S = $s") } \ No newline at end of file