Question: 6. The following MATLAB script interacts with the user to get a positive number N and then tells the user whether N is a prime

 6. The following MATLAB script interacts with the user to get

6. The following MATLAB script interacts with the user to get a positive number N and then tells the user whether N is a prime number or not. N=input('Enter a positive N:') if isprime (N) ==1 disp('Prime number' ); elseif isprime (N)==0 disp('Not a prime number'); end -Type the program and try it. - Add commands between the first and the second line so that the error message "N must be positive" is shown in case N is not positive. - Replace the if/elseif/end set of commands by a set of switch/case/end commands in a way that the program retains its functionality

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!