Write a program that calculates the division of two input numbers. It may throw an ArithmeticException. Fix it to avoid the exception.
In the case when the exception can happen, the corrected program should output: Division by zero, please fix the second argument!.
Taming exceptions
Handle arithmetic exception
Report a typo
Sample Input 1:
8
2Sample Output 1:
4Sample Input 2:
8
0Sample Output 2:
Division by zero, please fix the second argument!Write a program in Kotlin
fun main() {
// put your code here
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.