Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 16 additions & 27 deletions programs/vowel.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
import java.util.Scanner;
class Vowel
{
public static void main()
public static void main() throws Exception
{
boolean isVowel=false;;
Scanner sc=new Scanner(System.in);
System.out.println("Enter a character : ");
char ch=sc.next().charAt(0);
sc.close();
switch(ch)
{
case 'a' :
case 'e' :
case 'i' :
case 'o' :
case 'u' :
case 'A' :
case 'E' :
case 'I' :
case 'O' :
case 'U' : isVowel = true;
}
if(isVowel == true) {
System.out.println(ch+" is a Vowel");
}
else {
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
System.out.println(ch+" is a Consonant");
else
System.out.println("Input is not an alphabet");
}
}
}

char ch=Character.toUpperCase(ch);
if(ch == 'A'||ch == 'E'||ch == 'I'||ch == 'O'||ch =='U')
System.out.println("It is a Vowel");

else if((ch != 'A'||ch != 'E'||ch != 'I'||ch != 'O'||ch != 'U')&& Character.isLetter(ch)==true)
System.out.println("It is a Consonant.");
else
System.out.println("It is a Special Character.");




}
}