Answer to Question #249240 in MatLAB for rainy_taush

Question #249240
[QUOTE][b]
1
Expert's answer
2021-10-10T09:08:28-0400
clear;clc;

q = input('enter any quote in english:','s');%accepting any quote as a string
  
in = input('which letter do you want to count:','s');%asking which letter to count
tex = find(q == in);%finding the letter in the quote
count_tex = length(tex);%counting the number of instances
fprintf('The number of %s are: %d.\n',in,count_tex);%output the count
v = ['a','e','i','o','u'];%vowels
count_vow = 0;
%counting each vowel
for i = 1:5
count_vow = count_vow+length(find(q == v(i)));
end

fprintf('The number of vowels are: %d.\n',count_vow);%output of vowel count

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS