Kotlin Program:

- To print whether an alphabet is Vowel or Consonant

Example:

User Input: z

Output: It's a consonant

import java.util.Scanner
fun main(args: Array<String>) {
    
  val userInput = Scanner(System.`in`)
  print("Enter your character : ")
  var c:Char = userInput.next().get(0)
  
  if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U')
    println("It's a vowel");
  else 
    println("It's a consonant")

}

Output:

  Enter your character : E
  It's a vowel
Program
basic

You should know first :

Vowel alphabets: a, e, i, o, u

Consonant alphabets: Alphabets other than vowels

//Check for vowels both in uppercase & lowercase
  if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U') {
    //if true print vowel
  }
  else {
    //if false print consonant
  } 
  
Concept

Coming Soon !

Quick
Tutorial

Quote

Sometimes it’s the smallest decisions that can change your life forever.