Computer Applications
Write a program that inputs an alphabet and checks if the given alphabet is a vowel or not.
Answer
import java.util.Scanner;
public class KboatVowelCheck
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a character: ");
char ch = in.next().charAt(0);
ch = Character.toUpperCase(ch);
if(ch == 'A' ||
ch == 'E' ||
ch == 'I' ||
ch == 'O' ||
ch == 'U')
System.out.println("Vowel");
else
System.out.println("Not a vowel");
}
}
Variable Description Table
Program Explanation
Output
Related Questions
Write a program that takes a number and check if the given number is a 3 digit number or not. (Use if to determine)
Write a program that inputs a character and prints if the typed character is in uppercase or lowercase.
Write a program to input three numbers and print the largest of the three numbers.
Write a program that inputs a character and prints if the user has typed a digit or an alphabet or a special character.