Java

Calculate The Vowels In The Given String Using Java

Calculate The Vowels In The Given String Using Java
// Vowels program 

import java.io.*; 
import java.lang.String.*; 
import java.text.*; 

class ssva26 
{ 
public static void main(String arg[]) throws IOException 
{ 
String str; 
char s; 
int ch=0,l; 
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); 
System.out.println("\n\t\t\t\tCount the Vowels"); 
System.out.println("\n\t\t\t\t~~~~~~~~~~~~~~~~"); 
System.out.print("\nEnter the String: "); 
str = inp.readLine(); 
l=str.length(); 
for(int i=0;i<l;i++) 
{ 
s=str.charAt(i); 
if( (s=='a') || (s=='e') || (s=='i') || (s=='o') || (s=='u') ) 
ch++; 
} 
System.out.println("\nNumber of vowels: " + ch); 
} 
}

Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.