Lecture 8 – September 21st, 2006

 

 

Notes from 2:00 class – courtesy of Zach

 

 

Notes from 3:30 class – courtesy of Alan

 

 

FORTRAN Code examples:

 

C  this program was written to test whether a subroutine
C  could be placed inside a FORTRAN main program
          K = 5
          J = 27
          WRITE (6, 10) K, J
          CALL SWAP (K,J)
 
   10     FORMAT (1X,  I5, I5)
          WRITE (6, 10) K, J
         SUBROUTINE SWAP ( M,N)
             ITEMP = M
             M = N
             N = ITEMP
         RETURN
         END
 
          WRITE (6, 10) K, J
          STOP
          END

 

 

C  THIS PROGRAM IS ATTEMPTING TO DETERMINE WHETHER A REAL NUMBER
C  CAN BE USED AS THE LOOP INDEX OF A DO LOOP
        DO 10 I = 1,10,2
           WRITE (6, 11) I
   10   CONTINUE
   11   FORMAT (1X, I5)
        DO 20  X = 1, 5, 0.5
           WRITE (6, 12) X
   20   CONTINUE
   12   FORMAT (1X , F4.1)
        STOP
        END

 

 

Link to Comments on first FORTRAN program

 

Link to sample grading sheet for first FORTRAN program ( you can use this to add up your points).  If you lost points for sorting in descending order, I will give them back.  You can check on Blackboard to see if your sum matches mine.  If not, come see me and I’ll adjust it.