Saturday, June 21, 2008
Count Vowels Example in Java
import java.lang.String;
import java.io.*;
import java.util.*;
public class vowels{
public static void main(String args[])throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter New String to Check :");
String text = bf.readLine();
int cnt = 0;
for (int a = 0; a < text.length(); a++) {
char b = text.charAt(a);
if (b=='a' || b=='e' || b=='i' || b=='o' || b=='u') {
cnt++;
}
}
System.out.println("Total Vowels are" + " : " + cnt);
}
}
Labels:
java example,
java source code,
vowel count example
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment