fun main() {
println("This is a calculator")
println("enter your first number")
val no1 = readLine()!!
println("enter your operation")
val operation1 = readLine()!!
println("enter your second number")
val no2 = readLine()!!
val result = if (operation1 == "*")
print(no1.toInt() * no2.toInt())
else if (operation1 == "+")
print(no1.toInt() + no2.toInt())
else if (operation1 == "-")
print(no1.toInt() - no2.toInt())
else if (operation1 == "/")
print(no1.toInt() / no2.toInt())
else
println("Please Enter just numbers and operations")
}
Whenever I run this, I can use whole numbers fine but the minute the answer is a decimal, it rounds and the if the userinput is a decimal, it comes up with an error.