Sunday, 25 December 2016

Java Program To Find Character Is Vowel Or Not

Program :- Write a Java Program To Find Character Is Vowel Or Not .In English Language there are only 5 Vowel's and rest are Consonants . your task is to check Entered character is vowel or not

Logic :- we know in English Language there are only 5 Vowel's and rest are consonants vowels Are A,E,I,O,U Or a,e,i,o,u  And Consonants Are B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Y,Z Or
b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,y,z So now we have to just check and match that character to given vowels

See Also :- C Program To Find Character Is Vowel Or Not

Solution :- 

/*Program By Ghanendra Yadav
   Visit http://www.programmingwithbasics.com/
*/

import java.util.Scanner;

public class vowel
{
    public static void main(String args[])
    {
        char ch;
        Scanner sc = new Scanner(System.in);

        System.out.print("Enter any Alphabet To Check : \n\n");
        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.print("Enter Character is a Vowel\n\n");
        }
        else
        {
            System.out.print("Enter Character isnot a Vowel\n\n");
        }
    }

}

See Also :- C++ Program To Find Character Is Vowel Or Not

Output:-


Java Program To Find Character Is Vowel Or Not

No comments:
Write comments

Recommended Posts × +