Java Program to Count the Vowels
Get a String and count the number of vowels occurred in string.
Sample Input 1:
Hello
Sample Output 1:
2
Program or Solution
import java.util.*;
class Program
{
public static void main(String args[])
{
String word;
int i,count=0;
Scanner sc=new Scanner(System.in);
System.out.println("Enter The Word:");
word=sc.next();
int len=word.length();
for(i=0;i<len;i++)
{
if(word.charAt(i)=='a' || word.charAt(i)=='e' || word.charAt(i)=='i' || word.charAt(i)=='o' || word.charAt(i)=='u')
{
count++;
}
}
System.out.println("The Occurences Is:"+count);
}
}
Program Explanation
Comments
Related Programs
- Java Program to Print the English Alphabets In Lower Case
- Java Program to Count The Occurences Of Character In a String
- Java Program to Compare two Strings are Equal
- Java Program to Concatenate two Strings
- Java Program to Count the Occurences of Sub String
- Java Program to find the index of character in a String
- Java Program to find length of a string
- Java Program to convert lower case to upper case
- Java Program to Find the Location of Sub String in String
- Java Program to Check whethet given String is Palindrome
- Java Program to Reverse the Given String
- Java Program to Remove the Spaces in given String
- Java Program to Remove the Vowels in given String
- Java Program to insert space between every Characters
- Java Program to Convert Uppercase to Lowercase
coming Soon
coming Soon