Computer Science, asked by poojashettypooj, 11 months ago

write a brute force algorithm to counting the number of vowels in the given text

Answers

Answered by ROCKbeat
1

Answer:

Logic: Here variable ‘vowels’ is incremented whenever a vowel found in tracing. Logic behind this is very simple, that comparing each character to the set of vowels, predefined in an array. If this character is in the set of vowels then it implies that character is a vowel, so we increment the count by one.

Same logic can be applied to find the existence of any letter set in the predetermined array.

Answered by vishakasaxenasl
0

Answer:

Following is a brute force algorithm to count the number of vowels in the given text:

Explanation:

Step I: Our first step is to take the text input from the user and store it in a string-type variable.

Step II: Initialize a counter variable to zero for counting the number of vowels present in the text.

STEP III: Then we iterate over the characters of the text using a loop.

STEP IV: If any character of the text matches with vowels ie (a,e, i,o,u) then we increase the counter variable by 1.

STEP V: On reaching the end of the text, we terminate the loop.

STEP VI: Now we return the value of the counter variable and our program ends here.

#SPJ2

Similar questions