answersLogoWhite

0


Best Answer

import java.io.*;

class test

{

public static void main()throws IOException

{

String s,p="";

char ch;

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

int i,c=0;

//input statement

System.out.println("Enter any string");

s=br.readLine();

s=s+" ";

for(i=0;i<s.length();i++)

{

ch=s.charAt(i);

if(ch!=' ')

{

p=p+ch;

}

else

{

if(p.startsWith("a")p.startsWith("e")p.startsWith("i")p.startsWith("o")p.startsWith("u"))

{

c++;

System.out.println(p.toUpperCase());

}

p="";

}

}

System.out.print("Total Words Starting with Vowels="+c);

}

}

by :

Pradeep Sir

Infonet Global Solutions

E-Block new Tempo Stand, Rajaji puram,

Lucknow-17

mob:- +91-9450821737

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program that accept a sentence and print all the words starting with vowels?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a program that stores vowels in an array When you program is given a character it should indicate whether the character is vowel or not?

That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.


Write a program to accept a string from keyboard and count and display the numbers of vowels present in the string by using function?

You need to scan through the string and keep track of the vowelsoccurring. Here is a sample program:#include#includeint countVowels(char[] s){int count = 0, i;for( i=0; char[i] != '\0'; i++){switch(char[i]){case 'a':case 'e':case 'i':case 'u':case 'o': count++;break;}}return count;}int main(){char str[256];printf("Enter the string:\t");scanf("%s", str);printf("The number of vowels in the string are :%d\n", countVowels(str));return 0;}


How do you replace a vowel into asterisk using java program loops?

If you want to do it neat and effortless, you may use enums. public class MyClass { private enum VOWELS { A,E,I,O,U,a,e,i,o,u; } public static void main(String []ar) { String s = "Hello World"; for(VOWELS c : VOWELS.values()) s = s.replace(c.name(), "*"); System.out.println(s); } } . Ram


To count the number of vowels in a text-flowchart?

flow chart


How do you write a program to delete all the vowels from a sentence assuming the sentence is no more than 80 characters long?

There is no need to assume the length if the sentence is represented by a null-terminated string. The following function will strip out all the vowels in any null-terminated string of any length, returning the number of vowels removed. Note that we don't create a new string, we simply modify the existing one since we know the modified string cannot be any longer than the existing one. If you want to retain the original string, simply make a copy of it before invoking this function. The p variable is a pointer and will initially refer to the first character of str, which is also a pointer. The cnt variable maintains a count of the vowels we removed. We use the str pointer to advance through the string one character at a time. When str is referring to a vowel we simply advance str to the next character leaving p where it is (effectively ignoring the vowels) and increment cnt. When str refers to a non-vowel, we copy the character from str to p and advance both pointers. When str reaches the null-terminator, we place a null-terminator in p and return the value of cnt. If any vowels were found there will be cnt characters beyond the new null-terminator. If the original string was a fixed-length array then you cannot remove these extra characters, but for variable length strings you may wish to reallocate, reducing the size of the allocation by cnt characters. int strip_vowels (char* str) { char * p = str; int cnt = 0; if (str==NULL) return cnt; while (*str != '\0') // test for null-terminator { switch (*str) // test for vowels { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U': str++; // str refers to a vowel, so ignore and advance to next character cnt++; // increment the count break; default: *p++ = *str++; // non-vowel -- copy the character and advance both pointers break; } } *p = '\0'; // ensure the modified string is null-terminated! return cnt; }

Related questions

5 letter word starting with r without vowels?

all words have vowels in them


What are the three letter words starting with vowels?

Some three letter words that start with vowels are:aceampapearearkarmarteareatelfemueraergiceI'llimpinkinnionireirkit'soafoakoaroatofforeouroutughumpurnuse


What five letter word STARTING Whas no vowels starting with t?

tryst


How would you use consonants in a sentence?

Consonants are the letters of the alphabet that are not vowels.


How many vowels are in the sentence The big bad wold had a stomatch ache and had to go to the hospital but he noticed that there were pigs on one end of a trail and red riding hood on another.?

There are 26 vowels in the sentence.


Which is used more in English - consonants or vowels?

I think that dubious distinction could be awarded to consonants, 21 vowels to 30 consonants in that sentence.


What are some fruits and vegetables starting with the vowels?

Eggplant? Apple? Orange?


Where do the vowels marks go for the Hebrew phrase I am free or ani khofshiya אני חופשיה?

If this sentence is written with vowels, it would look like this: &times;&#144;&Ouml;&sup2;&times;&nbsp;&Ouml;&acute;&times;&trade; &times;&mdash;&Ouml;&cedil;&times;&curren;&Ouml;&deg;&times;&copy;&times;&#129;&Ouml;&acute;&times;&trade;&Ouml;&cedil;&times;&rdquo; In this case, you would actually remove the letter vav (&times;&bull;) when writing this sentence with vowels.


What is a word that starts with a and means an articale used before words starting with vowels?

an


Word contain 9 letters which contain 3 vowels in it find out the sentence?

&quot;The dog barked loudly.&quot;


The following sentence includes all six vowels appearing in reverse alphabetical order Why run from fire ants?

The sentence is almost perfect. Notice that it also has the occasional vowels y and w in the proper place, although the w is not a vowel here.


How do you write c program to accept a string from the console and count number of vowels constants digits tabs and blank spaces in a string?

Read the characters one at a time, and write an "if" for each of the cases. In each case, if the condition is fulfilled, increment the corresponding counter variable.