Java Programming
C Programming

WAP to initilize a character and print whether it is a vowel or not?

Answer

Wiki User
01/17/2009

// short version

char c = 'a';

System.out.println((c=='a'c=='e'c=='i'c=='o'c=='u')?"VOWEL":"CONSONANT");

// easy to read version

char c = 'a';

switch (c) {

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

System.out.println("VOWEL");

break;

default:

System.out.println("CONSONANT");

}