import java.io.*;
class vowel
{
public static void main(String args[])
{
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the string:");
String s=br.readLine();
int vcnt=0;
int l=s.length();
char ch;
for(int i=0;i<l;i++)
{
ch=s.charAt(i);
if(ch=='A'|| ch=='a'|| ch=='E'|| ch=='e'|| ch=='I'|| ch=='i'|| ch=='O'|| ch=='o'|| ch=='U'|| ch=='u')
{
vcnt++;
}
}
System.out.println("The number of vowels in string is:"+vcnt);
}
catch(Exception e)
{}
}
}
http://adf.ly/hFnVj
class vowel
{
public static void main(String args[])
{
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the string:");
String s=br.readLine();
int vcnt=0;
int l=s.length();
char ch;
for(int i=0;i<l;i++)
{
ch=s.charAt(i);
if(ch=='A'|| ch=='a'|| ch=='E'|| ch=='e'|| ch=='I'|| ch=='i'|| ch=='O'|| ch=='o'|| ch=='U'|| ch=='u')
{
vcnt++;
}
}
System.out.println("The number of vowels in string is:"+vcnt);
}
catch(Exception e)
{}
}
}
http://adf.ly/hFnVj
No comments:
Post a Comment