Java Program to Calculate No. of Vowels

Here is a simple program to calculate number of vowels….

import java.lang.String;
class numofvowels
{
    public static void main(String a)
    {
        System.out.println(“Word :”+a);
        int numvowels=0;
        int len1=a.length();
        String b=a.toLowerCase();
        for (int i=0;i        {
         if (b.charAt (i)==’a’||b.charAt (i)==’e’||b.charAt (i)==’i’||b.charAt (i)==’o’||b.charAt (i)==’u’)
            {
                ++numvowels;
            }
        }
        System.out.println(“No. of Vowels :”+numvowels);
    }
}

Add Comment