This preview shows page 1. Sign up to view the full content.
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
This note was uploaded on 08/14/2012 for the course COMP 116 taught by Professor Stotts during the Fall '08 term at UNC.
 Fall '08
 Stotts

Click to edit the document details