import java.util.Scanner;
public class VOWELS_CONST {
public static void main(String[] args) {
String s;
char c;
int j =0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string");
s = sc.nextLine();
System.out.println("vowels in a string are");
for(int i=0; i<s.length(); i++){
c = s.charAt(i);
switch(c)
{
case 'a' :
case 'e' :
case 'i' :
case 'o' :
case 'u' :
case 'A' :
case 'E' :
case 'I' :
case 'O' :
case 'U' : j =1;
System.out.println(c);
}
}
if(j==0)
System.out.println("There are no vowel in string");
}
}
//output
Enter a string
hii i am amit
vowels in a string are
i
i
i
a
a
i
Process finished with exit code 0
0 Comments