SUBROUTINE array_of_sines(angle,low,high) ! Copyright 1994, Miles Ellis, Ivor Philips and Tom Lahey ! Copyright 1994, Addison-Wesley Publishers Ltd. ! Copyright 1994, Addison-Wesley Publishing Company Inc. ! Permission is granted for the use of this code for the purpose of teaching ! and/or learning the Fortran 90 language provided that the above copyright ! notices are included in any copies made. ! Neither the authors nor the publishers accept any responsibility for ! any results obtained by use of this code. IMPLICIT NONE ! This subroutine calculates and prints the sines of ! the angles supplied as its argument ! Dummy arguments INTEGER, INTENT(IN) :: low,high REAL, DIMENSION(low:high), INTENT(IN) :: angle ! Local variables REAL, DIMENSION(low:high) :: sine ! Automatic array INTEGER :: i ! Calculate sines sine = SIN(angle) ! Print table of sines DO i=low,high PRINT *,"sin(",angle(i),") = ",sine(i) END DO END SUBROUTINE array_of_sines PROGRAM exercise_7_4 ! Copyright 1994, Miles Ellis, Ivor Philips and Tom Lahey ! Copyright 1994, Addison-Wesley Publishers Ltd. ! Copyright 1994, Addison-Wesley Publishing Company Inc. ! Permission is granted for the use of this code for the purpose of teaching ! and/or learning the Fortran 90 language provided that the above copyright ! notices are included in any copies made. ! Neither the authors nor the publishers accept any responsibility for ! any results obtained by use of this code. IMPLICIT NONE ! This program tests the subroutine "array_of_sines" REAL, PARAMETER :: pi = 3.1415927 ! Declaration of array of angles INTEGER, PARAMETER :: low_bound=1, high_bound=12 REAL, DIMENSION(low_bound:high_bound) :: angles = & (/ -pi/2., -pi/3., -pi/4., -pi/6., 0.0, & pi/6, pi/4., pi/3., pi/2., 2.*pi/3., & 5.*pi/6., pi /) ! Calculate and print sines of angles CALL array_of_sines(angles,low_bound,high_bound) END PROGRAM exercise_7_4