DEV Community

Biswa ranjan Patra
Biswa ranjan Patra

Posted on

count vowel(a,e,i,o,u) & show element not use inbuild method

`public class Vowel {

public static void main(String[] args)
{
    String[] name= {"Hello","Bye","Notokay"};
    int vowelcount=0;
    for (int i = 0; i < name.length; i++) {
        String name1=name[i];// saparate the index
         char s=' '; // to create the empty charater
        for(int j=0;j<name1.length();j++)
        {
       char h=name1.charAt(j);// saparate the char 
       if(h=='a'||h=='e'||h=='i'||h=='o'||h=='u'||h=='A'||h=='E'||h=='I'||h=='O'||h=='U')
       {
           vowelcount ++;
           s=h;     
       }}
        System.out.println( s);    
    }       
    System.out.println("print the name "+ vowelcount ++);       
}}
Enter fullscreen mode Exit fullscreen mode

`
OUTPUT:-

o
e
a
print the name 6

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.