Create a function myPrimes that returns the first n primes as a vector, given a positive integer. For example, if the positive integer is 5, the vector returned would include 1, 2, 3, 5, 7. In your script, prompt the user for the positive integer val
clc; close all; clear all;
n=input('Prime Numbers until:');
function result = myPrimes(n)
This is my current code. In order for it to output the primes I have to type myPrimes(n) with the desired input for n instead of just entering a number and getting an output.
Answers (1)
Refactor the first two lines to
clc;
n=input('Prime Numbers until:');
output = myPrimes(n)
Edit : Addressed @Rik 's feedback