package com.includehelp.basic
// Main Method Entry Point of Program
fun main(args: Array<String>) {
// Input name
println("Enter Your Name: ")
val name = readLine()
// Input Address
println("Enter Your Address: ")
val add = readLine()
// Input Country Name
println("Enter Your Country Name : ")
val country = readLine()
// Printing input values
println("Name: $name")
println("Address: $add")
println("County: $country")
}
Output
Enter Your Name:
Shivang
Enter Your Address:
Indore, sector 73
Enter Your Country Name :
India
Name: Shivang
Address: Indore, sector 73
County: India
In the above program, we are asking the values for name, address and country. All three values are strings and they are reading by readLine() method.
Program to input a string in Kotlin
Output
In the above program, we are asking the values for name, address and country. All three values are strings and they are reading by readLine() method.
need an explanation for this answer? contact us directly to get an explanation for this answer