I have written a code to find the standard deviation of all elements in a vector (the first n primes are inputted). Whilst my code always compiles it will crash when certain vector sizes are input. 3 is an example. I cant see why the size of the vector changes anything.
Sorry, I am new to this forum. I have edited to include the mean function. It now runs but outputs 'nan' as I didnt include the vector filling code to stop the post getting too long. I can if it will help though?