I'm triying to learn Kotlin , and I just made a calculator program from console. I have functions to sum , divide etc. And when I try to cast to integers to float I get this error:
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Float
The function is this:
fun divide(a:Int,b:Int):Float{
return a as Float / b as Float;
}
What I'm doing wrong?