CHECK WHETHER INPUT ALPHABATE IS A VOWEL OR NOT

This is programe using the if loop we can find out character is vowel or not.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.io.*;
import java.util.Scanner;
public class Vowel
{
    public static void main(String[] args) throws IOException
    {
         char ch;  
         Scanner br = new Scanner(System.in);
         System.out.println("Enter charcter:");
         ch=br.next().charAt(0);

 

            if((ch=='a')||(ch=='e')||(ch=='i')||(ch=='o')||(ch=='u')
         ||(ch=='A')||(ch=='E')||(ch=='I')||(ch=='O')||(ch=='U'))
         System.out.println("given chacter is vowel");
         else
         System.out.println("chacter is not a vowel");
    }
}

Output :Alphabet is a Vowel or not

addm