Question: Write a Matlab function, called testprime, that takes one input argument and uses a for - loop and rem function to check whether its argument
Write a Matlab function, called testprime, that takes one input argument and uses a forloop and rem function to check whether its argument is a prime number. testprimex should return if x is a prime number and otherwise.
Your testprime function must behave as shown below:
help testprime
testprime checks if its argument is a prime
testprimex is if x is a prime, otherwise.
Author:
testprime
ans
logical
testprime
ans
logical
Hint: To get a logical and logical as output of your function, see help true and help false
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
