Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started