-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVowelWord.java
44 lines (38 loc) · 1.25 KB
/
VowelWord.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Write a Java Program to Input a sentence and print those words which begin with a vowel
import java.io.*;
class Vowel_Word
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.print("Enter any sentence: ");
String s=br.readLine();
s = s+" ";
int l=s.length();
int pos=0;
char ch1, ch2;
String w;
for(int i=0; i<l; i++)
{
ch1 = s.charAt(i);
if(ch1 == ‘ ‘)
{
w = s.substring(pos,i); // extracting words one by one
ch2 = w.charAt(0);
if(ch2==’A’ || ch2==’E’ || ch2==’I’ || ch2==’O’ || ch2==’U’ ||
ch2==’a’ || ch2==’e’ || ch2==’i’ || ch2==’o’ || ch2==’u’)
{
System.out.println(w);
}
pos = i+1;
}
}
}
}
👋 Hi, I’m @aarushinair - Aarushi Nair (she/her/ella)
👀 I’m a Computer Science Engineering Student
💞️ I’m looking to collaborate on #java, #python, #R, #applicationdevelopment
🌱 #GirlsWhoCode #WomenInTech #WomenInIT #WomenInSTEM #CyberSecurity #QuantumComputing #BlockChain #AI #ML
📫 How to reach me: https://www.linkedin.com/in/aarushinair/
👩🏫 YouTube Channel - Code with Aarushi : https://www.youtube.com/channel/UCKj5T1ELHCmkGKujkpqtl7Q
🙋 Follow me on Twitter: https://twitter.com/aarushinair_