TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Calculate The Vowels In The Given String Using Java
Senthilvelan Sambamoorthy
Aug 13
2016
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ssva26.rar
// Vowels program
import
java.io.*;
import
java.lang.String.*;
import
java.text.*;
class
ssva26
{
public
static
void
main(String arg[])
throws
IOException
{
String str;
char
s;
int
ch=
0
,l;
BufferedReader inp =
new
BufferedReader(
new
InputStreamReader(System.in));
System.out.println(
"\n\t\t\t\tCount the Vowels"
);
System.out.println(
"\n\t\t\t\t~~~~~~~~~~~~~~~~"
);
System.out.print(
"\nEnter the String: "
);
str = inp.readLine();
l=str.length();
for
(
int
i=
0
;i<l;i++)
{
s=str.charAt(i);
if
( (s==
'a'
) || (s==
'e'
) || (s==
'i'
) || (s==
'o'
) || (s==
'u'
) )
ch++;
}
System.out.println(
"\nNumber of vowels: "
+ ch);
}
}
Java