Numerical Modelling in Fortran: day 2
Numerical Modelling in Fortran: day 2
Numerical Modelling in Fortran: day 2
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Exercise 2: Mean and standard deviation<br />
• Convert your mean & stddev program from<br />
last week <strong>in</strong>to a function or subrout<strong>in</strong>e<br />
that operates on a 1-D array passed <strong>in</strong> as<br />
an argument.<br />
• Write a ma<strong>in</strong> program that<br />
– asks for the number of values,<br />
– allocates the array,<br />
– reads the values <strong>in</strong>to the array,<br />
– calls the function you wrote and<br />
– pr<strong>in</strong>ts the result<br />
• A function can’t return both mean & stddev,<br />
so one of them will have to be an argument