KT
kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*Challenge : Vowel Counter
1) Get A Messages From User.// string or char
2) Count The No Of Vowel In It.
3) Print The Number.
Ex - Get Messege = Faisal
Result = 3
*/
fun main(args: Array<String>) {
var you = readLine();
//input
var vowels = 0
you = you!!.toLowerCase()
for (i in 0..you.length - 1) {
val ch = you[i]
if (ch == 'a' || ch == 'e' || ch == 'i'
|| ch == 'o' || ch == 'u') {
++vowels
} }
println(" str : " +you+"\n Vowels: $vowels")
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run