Friday, February 14, 2020

Check Vowel sound in java pgm


Image result for vowel or not  in java concept


import java.util.Scanner;
class vowel
{
  public static void main(String[]args)
{
  char a;
  Scanner k=new Scanner(System.in);
  System.out.println("enter any character");
  a=k.next().charAt(0);
int b;
b=(int)a;
b=b-32;
a=(char) b;
switch(a)
{
    case 'A':
    case 'E':
    case 'I':
    case 'O':
    case 'U':
    System.out.println("it's a vowel"+a);
    break;
   default:
     System.out.println("it's not a vowel"+a);
}
}
}

No comments:

Post a Comment