0

what's wrong with my code below?

fun main(args: Array<String>) { var a=readLine()!!.toDouble(); var b=readLine()!!.toDouble(); val Double c="subtraction is${a-b}" print(c); }

4th Jan 2019, 6:40 PM
Cankardeş Cancan
Cankardeş Cancan - avatar
1 Resposta
+ 3
in Sololearn you can only ask input for one time. Also you are storing a string into a double variable. If you want to declare a type of a variable val b : Double = 3.5; fun main(args: Array<String>) { var a : Double = readLine()!!.toDouble(); var b : Double = readLine()!!.toDouble(); val c = "subtraction is " + (a-b); print(c); }
4th Jan 2019, 7:21 PM
Toni Isotalo
Toni Isotalo - avatar