Practice Quiz # 9 (With Solutions)

We want to make count equal to the number of times

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end (Continued on reverse side of page) same = strcmp(s3,s2); 3. We want to make ‘count’ equal to the number of times ‘chuck’ appears in s1 and s2. c1 = length(strfind(s1,`chuck’)); c2 = length(strfind(s2,`chuck’)); count = c1+c2; s12 = s1 + s2; count = … length(strfind(s12,`chuck’)); s12 = strcat(s1,s2); count = … length(strfind(s12,`chuck’)); Problem 2. {6 points} For each of the following problems write a function that accomplishes the specified task using a counted (for) or conditional loop (while). Do *NOT* use quick and easy MATLAB commands (such as ‘find’) in solving these functions. Do not worry about error checking or comments. Be as concise as possible. All problems have relatively short solutions. 1. [2pts] Write a function ‘ThreeFiveSum’ which returns the sum of all multiples of...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online