Contact Us
||
Privacy Policy
||
About Us
Home
Java
Progarm
PHP
Current Affairs
Menu ▼
Program
Vowel or Constant
Area of Circle
Find the Triangle
Compound Interest
Prime Number
Reverse Number
Factorial Number
Sum of Element
User Input
Calculate Average
Even or Odd
N Prime Number
1 to n Prime Number
Reverse String
Reverse String by User
Check Leap Year
HexaDecimal String
Binary to Decimal
Get IP
Check ArmStrong
ArmStrong Or Not
next →
1) Write a program to Find the Vowel and Constant .
Program
import java.util.Scanner; class Vowel { public static void main(String[ ] arg) { int i=0; Scanner sc=new Scanner(System.in); System.out.println("Enter a character : "); char ch=sc.next( ).charAt(0); if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U') { System.out.println("Entered character "+ch+" is Vowel"); } else if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')) System.out.println("Entered character "+ch+" is Consonant"); else System.out.println("Not an alphabet"); } }
Next Topic
next →