Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ENG10004-Portfolio Swinburne University of Technology (Sarawak Campus) 2. Problem-solving using MATLAB program Write a custom function with the declaration: PPTasklp2 (N) and save it in

image text in transcribed
ENG10004-Portfolio Swinburne University of Technology (Sarawak Campus) 2. Problem-solving using MATLAB program Write a custom function with the declaration: PPTasklp2 (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: (25) and verify if the following PPTasklp2_f (25) 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 AND 5 16 is NOT divisible by 3 or 5 17 is NOT divisible by 3 or5 18 is divisible by 3 19 is NOT divisible by 3 or 5 20 is divisible by 5 21 is divisible by 3 22 is NOT divisible by 3 or 5 23 is NOT divisible by 3 or 5 24 is divisible by 3 25 is divisible by 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago