Problem
Write a program to take a character as input and check whether the given character is a vowel or a consonant.
Vowels are 'A', 'E', 'I', 'O', 'U'. Rest all alphabets are called consonants.
Input Format
- First line will contain the character .
Output Format
Print "Vowel" if the given character is a vowel, otherwise print "Consonant".
Constraints
Sample 1:
Z
Consonant
Program :
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
char C=sc.next().charAt(0);
if(C=='A'||C=='E'||C=='I'||C=='O'||C=='U')
{
System.out.println("Vowel");
}
else
{
System.out.println("Consonant");
}
}
}
0 Comments