! This is a basic starting shell for your programs MODULE const INTEGER, PARAMETER :: dp = KIND(1.0d0), sp = KIND(1.0e0) REAL(KIND=dp), PARAMETER :: dpi = 3.141592653589793d0 END MODULE const ! PROGRAM prog USE const IMPLICIT NONE ! Program to evaluate the piecewise function from the notes ! using nested IF-THEN-ELSE logic ! REAL(kind=dp) :: x,y,f WRITE(*,*) 'Input x,y' READ(*,*) x,y IF( x >= 0) THEN IF(y >= 0) THEN f = cos(x)*sin(y) ELSE f = sin(x)*cos(y) ENDIF ELSE IF(y >= 0) THEN f = cos(x)*cos(y) ELSE f = sin(x)*sin(y) ENDIF ENDIF WRITE(*,*) 'f = ',f END PROGRAM prog