0

please explain the problem with this code as i am new to kotlin

Fun main(args: Array<String>) { var x:Int= readLine()!!.toInt() var y:Int= x+x var z:Int= y+(y/10) println("your amount is" + z) }

21st Dec 2021, 8:35 AM
PPJSV shivansh
PPJSV shivansh - avatar
1 Answer
0
Suppose you got 12,345 as input for integer <x> Integer <y> is <x> + <x> 12,345 + 12,345 => 24,690 And Integer <z> is <y> + ( <y> / 10 ) 24,690 + ( 24,690 / 10 ) 24,690 + 2,469 => 27,159 Then output <z> on console screen, with a line break. Except for the auto-cap side effects where 'fun' was written as 'Fun'; I didn't see any problem. Perhaps you can descibe the problem in the Description? ☝ What was the code supposed to do? (Edited)
21st Dec 2021, 8:58 AM
Ipang