Computer Science, asked by kanup4747, 9 months ago

Write a program that inputs an alphabet and checks if the given alphabet is a vowel or not.​

Answers

Answered by ꜱɴᴏᴡyǫᴜᴇᴇɴ
14

Explanation:

In English alphabet the characters 'a', 'e', 'i', 'o','u' are vowels and remaining letters are consonants. To find whether the given letter is a vowel or consonant. Using loop and or operator verify whether given character is 'a' or 'e' or 'i' or 'o' or 'u' else it is consonant.

Answered by rohinisaiprani883
1

Answer:

input

import java.util.Scanner;

public class VowelOrConsonant {

public static void main(String args[]){

System.out.println("Enter a character :");

Scanner sc = new Scanner(System.in);

char ch = sc.next().charAt(0);

if(ch == 'a'|| ch == 'e'|| ch == 'i' ||ch == 'o' ||ch == 'u'||ch == ' '){

System.out.println("Given character is an vowel");

}else{

System.out.println("Given character is a consonant");

}

}

}

output

Enter a character :

a

Given character is an vowel

Enter a character :

l

Given character is a consonant

Similar questions