OneCompiler

CountVowels

148

package practiceQuestions;
import java.util.Scanner;

public class CountVowels1 {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	
	Scanner sc = new Scanner(System.in);
	System.out.println("Enter the String :");
	String s = sc.nextLine();
	String s1= s.toUpperCase();
	String s2 =s.toLowerCase();
	sc.close();
	int count =0;
	System.out.println("length of String is " +s.length());
	for(int i=0;i<s.length();i++) {
		if(s.charAt(i)=='A' ||s.charAt(i)=='E' ||s.charAt(i)=='I' || s.charAt(i)=='O'|| s.charAt(i)=='U') {
			
			System.out.println("Vowels found at : " +s.charAt(i));
			count = count +1;
			
		}
		
	}
	System.out.println("Total numbers of vowel found at string :" +count);
	

}

}