Functions
function cube_root(x) result(root)
! A function to calculate the cube root of a positive real number
! Dummy argument declaration
real, intent(in) :: x
! Result variable declaration
real :: root
! Local variable declaration
real :: log_x
! Calculate cube root by using logs
log_x = log(x)
root = exp(log_x/3.0)
end function cube_root
Previous slide
Next slide
Back to first slide
View graphic version