To check the given charecter is vowel or Consonant


Java Program To check the given charecter is vowel or Consonant 


Implementation :-

import java.util.Scanner;
class VowelConst1
{
    public static void main(String[] args)
    {
        System.out.println("Enter a Character: ");
        Scanner sc = new Scanner(System.in);
        char ch = sc.next().charAt(0);
        if(ch =='a' || ch =='A'|| ch=='e' || ch =='E' || ch =='i' || ch =='I' || ch =='o' || ch =='O' || ch =='u' || ch =='U')
            {
                System.out.println("Character is Vowel");
            }
        else
           {
               System.out.println("Character is consonant");
           }
    }
}




 Output:
 Enter a Character:
 a
 Character is Vowel

Comments

Popular posts from this blog

C program that contains a string XOR each character in this string with 0 ,127

Queue in Data Structure(DS)

Implementation of stack Using Array