Computer Science, asked by Srinitasingh768, 3 months ago

write a program in java to accept any sentence and display the number of vowels in different lines. ​

Answers

Answered by kamalrajatjoshi94
1

Answer:

import java.util.*;

public class Vowel

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

int p,v=0,i;

String st;

char ch;

System.out.println("Enter a String");

while(true)

{

st=in.next();

if(st.equals(".")

break;

}

p=st.length();

for( i=0;i<p;i++)

{

ch=st.charAt(i);

if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')

v++;

}

System.out.println(st +":" v);

}

}

Similar questions