Is it a VOWEL or CONSONANT: VOWELTB
Public Submission link: Click here (anyone can submit here )
CU Submission link: Click here (need login by CU account)
Write a program to take a character (C)(C) as input and check whether the given character is a vowel or a consonant.
NOTE:−NOTE:− Vowels are ‘A’, ‘E’, ‘I’, ‘O’, ‘U’. Rest all alphabets are called consonants.
Input Format
- First line will contain the character CC.
Output Format
Print “Vowel” if the given character is a vowel, otherwise print “Consonant”.
Constraints
- CC willwill bebe anan upperupper casecase EnglishEnglish alphabetalphabet
Sample Input 1
Z
Sample Output 1
Consonant
Solution in C
int main()
{
char c;
scanf("%c",&c);
if(c=='A'|| c=='E'||c=='I'||c=='O'||c=='U')
{
printf("Vowel\n");
}
else
{
printf("Consonant\n");
}
return 0;
}
Is it a VOWEL or CONSONANT Codechef Solution in C++ 17
int main() {
char c;
cin>>c;
if(c=='A' || c=='E' || c=='I' || c=='O' || c=='U'){
cout << "Vowel" << endl;
}
else{
cout << "Consonant" << endl;
}
return 0;
}
Is it a VOWEL or CONSONANT Codechef Solution in Python 3
n=input()
if n=="A" or n=="E" or n=="I" or n=="O" or n=="U":
print("Vowel")
else:
print("Consonant")
Is it a VOWEL or CONSONANT Codechef Solution in Java
/* 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
char[] vowels = {'A', 'E', 'I', 'O', 'U'};
Scanner sc = new Scanner(System.in);
char C = sc.next().charAt(0);
// System.out.println(C);
if(isfound(vowels,C))
System.out.println("Vowel");
else
System.out.println("Consonant");
}
public static boolean isfound(char[] arr, char ch){
for (int i = 0; i < arr.length; i++) {
if(arr[i]==ch)
return true;
}
return false;
}
}