26.09.2013 Views

Chapter 11. More Fortran Elements: Functions and Subroutines 11.1 ...

Chapter 11. More Fortran Elements: Functions and Subroutines 11.1 ...

Chapter 11. More Fortran Elements: Functions and Subroutines 11.1 ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Chapter</strong> 11 Review Problems<br />

1. Construct an external function in <strong>Fortran</strong> to convert degrees Fahrenheit to Celsius. The<br />

function is passed the temperature in degrees Fahrenheit <strong>and</strong> returns the temperature in Celsius.<br />

Write a main program to input the temperature in degrees Fahrenheit <strong>and</strong> use the external<br />

function to convert to Celsius. The main program should then write out the temperature in<br />

degrees Fahrenheit <strong>and</strong> Celsius to the screen.<br />

2. Write an external function in <strong>Fortran</strong> to calculate the factorial n!<br />

3. Construct a subroutine to calculate the average <strong>and</strong> st<strong>and</strong>ard deviation of a data set. The<br />

subroutine should be passed the number of data points <strong>and</strong> a one-dimensional array containing<br />

the data.<br />

75

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!