Skip to content

Instantly share code, notes, and snippets.

@Ansarina
Created October 24, 2015 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ansarina/3c800c4d2e0ae53ea6af to your computer and use it in GitHub Desktop.
Save Ansarina/3c800c4d2e0ae53ea6af to your computer and use it in GitHub Desktop.
PROGRAM func
EXTERNAL CTN
INTRINSIC SIN, COS
REAL::angle=0.785 !...pi/4
REAL::sine,cosine,tangent
CALL TRIG(angle,SIN,sine)
WRITE(*,*) 'SIN(0.785)=',sine
CALL TRIG(angle,COS,cosine)
WRITE(*,*) 'COS(0.785)=',cosine
CALL TRIG(angle,CTN,cotangent)
WRITE(*,*) 'COTAN(0.785)=',cotangent
PAUSE
END PROGRAM func
SUBROUTINE TRIG(X,F,Y)
Y = F(X)
RETURN
END SUBROUTINE TRIG
FUNCTION CTN(X)
CTN = COS(X)/SIN(X)
RETURN
END FUNCTION CTN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment