Question: 2. Problem-solving using MATLAB program Write a custom function with the declaration: PPTasklp2 f (N) and save it in a file named PPTask1p2_ f.m. The

 2. Problem-solving using MATLAB program Write a custom function with the

2. Problem-solving using MATLAB program Write a custom function with the declaration: PPTasklp2 f (N) and save it in a file named PPTask1p2_ f.m. The function loops through the values from 1 to N and for each number n it should display in the command window: 'n is divisible by 3' (use disp function), 'n is divisible by 5', n is divisible by 3 AND 5', or n is NOT divisible by 3 or 5. You must use a for loop, the function rem to figure out if a number is divisible by 3 or 5, and num2str to convert each number to a string for displaying. You can use any combination of if, else, and elseif Call the function in the command window: PPTasklp2 information is displayed f (16) and verify if the following >PPTasklp2 f (16) 1 is NOT divisible by 3 or 5 2 is NoT divisible by 3 or 5 3 is divisible by 3 4 is NOT divisible by 3 or 5 5 is divisible by 5 6 is divisible by 3 7 is NoT divisible by 3 or 5 8 is NOT divisible by 3 or 5 9 is divisible by 3 10 is divisible by !5 11 is NOT divisible by 3 or 5 12 is divisible by 3 13 is NOT divisible by 3 or 5 14 is NOT divisible by 3 or 5 15 is divisible by 3 AND5 16 is NOT divisible by 3 or 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!