Write a program in kotlin to check the input char is vowel or consonant using when condition | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

Write a program in kotlin to check the input char is vowel or consonant using when condition

Values are input by the user

11th Jan 2019, 3:38 PM
Ankit Sharma
Ankit Sharma - avatar
7 Réponses
+ 3
Please show us your attempt.
11th Jan 2019, 3:43 PM
HonFu
HonFu - avatar
+ 3
fun main(args: Array<String>) { var ch= readLine()!!toChararray(); when(ch) 'a','e','i','o','u' ->println ("char is vowel") else-> println("Char is consonant") }
11th Jan 2019, 4:00 PM
Ankit Sharma
Ankit Sharma - avatar
+ 3
I don't speak Kotlin myself, but I hope someone will help you soon. :)
11th Jan 2019, 4:02 PM
HonFu
HonFu - avatar
+ 2
Echo Echo Why you use [0] tell me
11th Jan 2019, 4:52 PM
Ankit Sharma
Ankit Sharma - avatar
+ 2
Echo Echo Can we directly read char values in this program without array
11th Jan 2019, 4:55 PM
Ankit Sharma
Ankit Sharma - avatar
+ 1
Echo Echo Thank you so much for your help I was in trouble about this kind of error and i didn't find any help to get me out from error in this program. Thank you so much again...
11th Jan 2019, 5:13 PM
Ankit Sharma
Ankit Sharma - avatar
+ 1
Echo Echo Actually I tried yet but I didn't get this on google.
11th Jan 2019, 5:26 PM
Ankit Sharma
Ankit Sharma - avatar