fun main() { val inp:Int?=readLine()?.toIntOrNull(); if(inp!=null){ val sqr=inp*inp; println("Ssquare of given number is:$sqr") } else{ println("Input is null"); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter