Write a program in java to input a character and print weather it is vowel or not.
Answers
Answered by
3
main buttonbutton
Java Program to Check Vowel or Not
« Previous ProgramNext Program »
Check Vowel or Not
To check whether the input alphabet is a vowel or not in Java Programming, you have to ask to the user to enter a character (alphabet) and check if the entered character is equal to a, A, e, E, i, I, o, O, u, U. If it is equal to any one of the 10, then it will be vowel otherwise it will not be a vowel.
Java Programming Code to Check Vowel or Not
Following Java Program ask to the user to enter an alphabet to check whether it is a vowel or not, then display the result on the screen:
/* Java Program Example - Check for Vowel */
import java.util.Scanner;
public class JavaProgram
{
public static void main(String args[])
{
char ch;
Scanner scan = new Scanner(System.in);
System.out.print("Enter an Alphabet : ");
ch = scan.next().charAt(0);
if(ch=='a' || ch=='A' || ch=='e' || ch=='E' ||
ch=='i' || ch=='I' || ch=='o' || ch=='O' ||
ch=='u' || ch=='U')
{
System.out.print("This is a Vowel");
}
else
{
System.out.print("This is not a Vowel");
}
}
}
Java Program to Check Vowel or Not
« Previous ProgramNext Program »
Check Vowel or Not
To check whether the input alphabet is a vowel or not in Java Programming, you have to ask to the user to enter a character (alphabet) and check if the entered character is equal to a, A, e, E, i, I, o, O, u, U. If it is equal to any one of the 10, then it will be vowel otherwise it will not be a vowel.
Java Programming Code to Check Vowel or Not
Following Java Program ask to the user to enter an alphabet to check whether it is a vowel or not, then display the result on the screen:
/* Java Program Example - Check for Vowel */
import java.util.Scanner;
public class JavaProgram
{
public static void main(String args[])
{
char ch;
Scanner scan = new Scanner(System.in);
System.out.print("Enter an Alphabet : ");
ch = scan.next().charAt(0);
if(ch=='a' || ch=='A' || ch=='e' || ch=='E' ||
ch=='i' || ch=='I' || ch=='o' || ch=='O' ||
ch=='u' || ch=='U')
{
System.out.print("This is a Vowel");
}
else
{
System.out.print("This is not a Vowel");
}
}
}
Similar questions
Math,
6 months ago
Social Sciences,
6 months ago
Social Sciences,
6 months ago
Math,
1 year ago
English,
1 year ago