Question: Write a function called prime that receives a positive integer as input and returns true if the input is a prime number and returns false
Write a function called prime that receives a positive integer as input and returns true if the input is a prime number and returns false otherwise. Recall that a prime number is a whole number greater than 1 that cannot be obtained by multiplying two smaller whole numbers (i.e., a prime number can be divided exactly only by 1, or itself).
Your function should use a for loop. Here is a MATLAB built-in function which you may find useful:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
