Question: The output should have 5 numbers per line separated by commas. After the function has displayed all n values, only one new line should be
The
output should have numbers per line separated by commas.
After the function has displayed all n values, only one new line
should be at the end of the list of numbers. Display the CPU
time required to run the function on a new line after it has
printed out all of the prime numbers.
function dispprimen
This function is the starting point for the dispprime bonus
assignment. Your task is to modify this code so it will run
faster. Your bonus will be determined by how much faster your
code runs in comparison to this code.
The input value n is the number of prime numbers to display.
There is no function output but the code displays prime
numbers in the command window.
tic; c; v; Initialize values
if n dispNo primes'; Check for valid input
else
if n fprintf; c; end
if n fprintf; c; end
if n v;
while c
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
