Skip to main content

TRIGKB.f95

	PROGRAM TRIGKB
!
! Purpose: prompts for an angle in degrees from the keyboard and then prints
! out on the screen the sine, cosine and tangent of the angle.
!
	IMPLICIT NONE
	REAL:: THETA_DEG, THETA_RAD, PI
!
	WRITE(*,99,ADVANCE='NO')'Please enter an angle (in degrees). '
   99   FORMAT(A40)
	READ(*,*)THETA_DEG
!
! Convert the angle from degree to radians
	PI = 4.0*ATAN(1.0)
	THETA_RAD = THETA_DEG *PI/180.0
!
! Print out the results
	WRITE(*,100)'The angle is  ',THETA_DEG,' degrees'
	WRITE(*,101)'Its sine is   ',SIN(THETA_RAD)
	WRITE(*,101)'Its cosine is ',SIN(THETA_RAD)
	WRITE(*,101)'Its tangent is',TAN(THETA_RAD)
  100	FORMAT(1X,A14,1X,E15.7,A8)
  101	FORMAT(1X,A14,1X,E15.7)
!
	END PROGRAM TRIGKB