Java
class VowelorConsonant
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter an alphabet :");
char c=sc.next().charAt(0);
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
{
System.out.println(c+ " is VOWEL.\n");
}
else
System.out.println(c+ " is CONSONANT.\n");
}
}
Try it Yourself ➠
Alphabet is Vowel or Consonant in JAVA
14 May
0
Write a program (WAP) in JAVA to read two numbers from keyboard(User Input) to know a character is vowel or consonant.
import java.util.Scanner;class VowelorConsonant
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter an alphabet :");
char c=sc.next().charAt(0);
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
{
System.out.println(c+ " is VOWEL.\n");
}
else
System.out.println(c+ " is CONSONANT.\n");
}
}
Try it Yourself ➠
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment