Is it a VOWEL or CONSONANT Solution

Problem

Write a program to take a character (C) as input and check whether the given character is a vowel or a consonant.

NOTE:- Vowels are 'A', 'E', 'I', 'O', 'U'. Rest all alphabets are called consonants.

Input Format

  • First line will contain the character C.

Output Format

Print "Vowel" if the given character is a vowel, otherwise print "Consonant".

Constraints

  • C will be an upper case English alphabet

Sample 1:

Input
Output
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");

     }

}

}


Post a Comment

0 Comments