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); }
1 Antwort
+ 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);
}