Computer Science, asked by Ayeshaharoon, 16 days ago

Write a program that prompt the user for a word and count and print out the vowel letter in the word entered by the user

Answers

Answered by vishalandanuforever
1

Answer:

Algorithm

Define a string.

Convert the string to lower case so that comparisons can be reduced. ...

If any character in string matches with vowels (a, e, i, o, u ) then increment the vcount by 1.

If any character lies between 'a' and 'z' except vowels, then increment the count for ccount by 1.

Print both the counts.

Answered by Equestriadash
1

Source co‎de: [in Python]

\tt s\ =\ in put("Enter\ a\ word:\ ")\\print()\\vc\ =\ 0\\for\ i\ in\ s:\\{\ \ \ \ \ }if\ i\ in\ "AEIOUaeiou":\\{\ \ \ \ \ }{\ \ \ \ \ }vc\ +=\ 1\\{\ \ \ \ \ }{\ \ \ \ \ }print(i)\\print("Number\ of\ vowels:\ ",\ vc)

Explanation:

Once the word has been retrieved using the \tt in put() statement, a variable has been initialized to store the count of the vowels. A \tt for loop, which is an iteration statement used for repeated checking, is pas‎sed. The statement traverses through the string and checks for vowels using a conditional statement. If it satisfies the condition of being a vowel, the count is incremented by 1 and the vowel is displayed. The final count is then displayed.

Similar questions