This preview shows page 1. Sign up to view the full content.
Unformatted text preview: MSC321 Homework 1
Due Feb 4th 2011 1. Explain the difference between comments, variable declaration and executable statements. 2. What values are expected from the following operations (a) (2.0 + 3.0**2) / (8.0-2.0+1.0) (b) (2.0+3.0)**2 / (8.0-2.0+1.0) (c) 3.0/5.0 + 2.0 ** 3 (d) 3/5 + 2**3 3. What value is printed after the execution of the following program? Explain your answer. program test implicit none real :: x=3.0 integer :: i=7 x = x/(x-1.0)**2**(-1)-1.0 i = i + 1/i-3 print *, x,i stop end program test 4. If n is declared as an integer, what do you expect the following statement to print? m = n - (n/2)*2 5. Write FORTRAN statements to evaluate the function f= 1.0 + cos2 x (1.0 + x3 )(1 - x2 ) Hints Be careful about interpreting the types of constants, and remember that integer division is truncated. You need not write actual code and run them, but feel free to do so if you want to make sure of your answers. You need not hand in the programs. 1 ...
View Full Document
- Fall '08